home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / THINK C Digest / 1992 / 92-12 < prev   
Text File  |  1995-12-31  |  118KB  |  3,374 lines

  1. 
  2. Path: ucivax!gateway
  3. From: kirk_crawford@qmail2.aero.org (Kirk Crawford)
  4. Subject: No Members Defined
  5. Message-ID: <199212010003.AA12884@aerospace.aero.org>
  6. Posted-Date: 30 Nov 92 16:07:57 U
  7. Newsgroups: fa.think-c
  8. Lines: 13
  9. Date: 1 Dec 92 00:03:51 GMT
  10.  
  11. Subject:  No Members Defined
  12. I have some old Think 4 source I am trying to translate.  Think 5 is
  13. complaining about the following:
  14.  
  15. typedef struct
  16. {    sortEntry        sortData[];
  17. }    sortList;
  18.  
  19. It says "No Members Defined".  How do I translate this so that Think C 5 will
  20. like it?
  21.  
  22.  
  23.  
  24. 
  25. 
  26. Path: ucivax!gateway
  27. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  28. Subject: No Members Defined
  29. Message-ID: <9212011430.AA09420@chaos.cs.brandeis.edu>
  30. In-Reply-To: Kirk Crawford's message of 1 Dec 92 00:03:51 GMT <199212010003.AA12884@aerospace.aero.org>
  31. Newsgroups: fa.think-c
  32. Lines: 30
  33. Date: 1 Dec 92 14:30:21 GMT
  34.  
  35. >>>>> On 1 Dec 92 00:03:51 GMT, Kirk Crawford <kirk_crawford@qmail2.aero.org> said:
  36.  
  37.  > I have some old Think 4 source I am trying to translate.  Think 5
  38.  > is complaining about the following:
  39.  
  40.  > typedef struct
  41.  > {    sortEntry        sortData[];
  42.  > }    sortList;
  43.  
  44.  > It says "No Members Defined".  How do I translate this so that
  45.  > Think C 5 will like it?
  46.  
  47. You're going to have to add a non-zero dimension to your array
  48. declaration. This is due to the fact that C 5.0 (in accordance with
  49. ANSI C) disallows zero sized objects.
  50.  
  51. The only exception to this rule is that if you have "THINK C
  52. Extensions" on, you will be allowed to declare an array of zero
  53. dimension at the end of a struct, provided that the struct itself has
  54. other members.
  55.  
  56. I would change the declaration to sortData[1]. You'll need to check
  57. for any use of sizeof() on the above object, although I don't know
  58. what C 4.0 would return for it.
  59.  
  60.     -phil
  61. ----
  62.    Phil Shapiro                                   Software Engineer
  63.    Language Products Group                     Symantec Corporation
  64.            Internet: phils@cs.brandeis.edu
  65. 
  66. 
  67. Path: ucivax!gateway
  68. From: kent@centauri.dmc.com (Tom Kent)
  69. Subject: Re: $$$$$$$$$ (not money) $$$$$$$$$$$
  70. Message-ID: <01062011.k5ekh9@centauri.dmc.com>
  71. Newsgroups: fa.think-c
  72. Organization: Sophist Solutions
  73. Lines: 22
  74. Date: 3 Dec 92 01:37:09 GMT
  75.  
  76. In article <9211231939.aa17031@q2.ics.uci.edu> (dmc.think-c), Andrew McAllister <C511899@mizzou1.missouri.edu> writes:
  77. > Amen, using $ signs in C is very strange, but for some reason Apollo and
  78. > HP really likes using them. In fact almost every function call in Apollo's
  79. > graphics, network, and OS libraries use dollar signs.
  80.  
  81. DEC originally designated the dollar sign character as a component
  82. in all their system service calls, as a means of avoiding namespace
  83. conflicts with user-written code. Apollo appears to have adopted this
  84. practice, and it is certainly possible that HP or IBM predated DEC
  85. in this regard. Whoever started the trend, the others probably copied
  86. it to improve portability.
  87.  
  88. Despite the fact that I worked at DEC in the late 70s, I never got used to
  89. it because it is a shift character and because it makes the symbol
  90. name harder to read--my eyes seems to parse it as a delimiter, not a
  91. symbol constituent. But of course that's irrelevant.
  92.  
  93. --------
  94. Tom Kent                           Internet:       kent@centauri.dmc.com
  95. Sophist Solutions                  UUCP:           ...uunet!thehulk!kent
  96. 375 Pond St.                       CompuServe: 73300.2677@compuserve.com
  97. Dunstable, MA 01827                Office:                (508) 649-9968
  98. 
  99. 
  100. Path: ucivax!gateway
  101. From: kent@centauri.dmc.com (Tom Kent)
  102. Subject: Re: Virtually everyone...
  103. Message-ID: <01062011.k5fa9b@centauri.dmc.com>
  104. Newsgroups: fa.think-c
  105. Organization: Sophist Solutions
  106. Lines: 29
  107. Date: 3 Dec 92 01:37:09 GMT
  108.  
  109. In article <9211301732.AA24888@hobbes.kzoo.edu> (dmc.think-c), "Jamie R. McCarthy" <k044477@hobbes.kzoo.edu> writes:
  110. > Does anyone _not_ use the project option "Methods are virtual by
  111. > default?"  I've heard that C++ methods are non-virtual by default;
  112. > maybe it has something to do with this?
  113. > Should I start putting "virtual" in front of every method declaration I
  114. > make public?
  115.  
  116. Yes, it does relate to compatibility with true C++. But no, you shouldn't
  117. put it in front of each public method.
  118.  
  119. There are two reasons NOT to make a method virtual:
  120.  
  121. 1.    Runtime overhead. Making a method virtual implies that runtime
  122. accesses must scan a vtable to choose the right method. If the method
  123. won't ever need to be overridden, don't use virtual. (In true C++
  124. you can designate methods as inline to get better performance, but
  125. "virtual" necessarily disables "inline.")
  126.  
  127. 2.    Encapsulation. Sometimes you want a method to be publicly accessible
  128. but you don't want a subclass overriding it because you're class is
  129. the only one responsible for a particular datum or action. By keeping
  130. such methods nonvirtual you get a safer (lower "surface area") class
  131. and somewhat better performance.
  132.  
  133. --------
  134. Tom Kent                           Internet:       kent@centauri.dmc.com
  135. Sophist Solutions                  UUCP:           ...uunet!thehulk!kent
  136. 375 Pond St.                       CompuServe: 73300.2677@compuserve.com
  137. Dunstable, MA 01827                Office:                (508) 649-9968
  138. 
  139. 
  140. Path: ucivax!gateway
  141. From: Per.Mildner@csd.uu.se (Per Mildner)
  142. Subject: Re: Virtually everyone...
  143. X-Sender: perm@meryl.csd.uu.se
  144. Message-ID: <199212031316.AA18144@meryl.csd.uu.se>
  145. Newsgroups: fa.think-c
  146. X-Charset: ASCII
  147. Lines: 21
  148. Date: 3 Dec 92 13:16:52 GMT
  149. X-Char-Esc: 29
  150.  
  151. At 01.37 92-12-03 +0000, Tom Kent wrote:
  152. >There are two reasons NOT to make a method virtual:
  153. >
  154. >1.      Runtime overhead. Making a method virtual implies that runtime
  155. >accesses must scan a vtable to choose the right method. If the method
  156. >won't ever need to be overridden, don't use virtual. (In true C++
  157. >you can designate methods as inline to get better performance, but
  158. >"virtual" necessarily disables "inline.")
  159. >
  160. This is not correct. Firstly, vtables isn't "scanned" they are indexed,
  161. i.e., one addition and one dereference to access a particular method (for
  162. single inheritance at least)). Secondly, "virtual" doesn't NECESSARILY
  163. disable "inline", inline expansion can be done when the compiler knows
  164. about the runtime class of an object already at compile time (e.g., stack
  165. allocated objects in local scope). I belive e.g. Borland does this.
  166.  
  167. Per Mildner                      Preferred: Per.Mildner@CSD.UU.SE
  168. Computing Science Dept.          AppleLink: sw1106
  169. Uppsala University               tel: +46 18 181049
  170. Box 311, S-751 05 Uppsala,Sweden fax: +46 18 521270
  171.  
  172. 
  173. 
  174. Path: ucivax!gateway
  175. From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
  176. Subject: Think C 6.0
  177. Message-ID: <9212031458.AA16569@hobbes.kzoo.edu>
  178. X-Mailer: ELM [version 2.3 PL11]
  179. Newsgroups: fa.think-c
  180. Lines: 16
  181. Date: 3 Dec 92 14:56:09 GMT
  182.  
  183. Let me see if I have my facts straight.
  184. 1. Bedrock is due out at the beginning of next year.
  185. 2. Bedrock is going to be a C++ library.
  186. 3. Think C 5.04 is not a C++ compiler.
  187.  
  188. Therefore since Think C and Bedrock are both made by Symentic, more than
  189. likely Think C 6.0 will include a C++ compiler and will be out around the
  190. beginning of next year.  :-)
  191.  
  192. Anyone care to comment?
  193.  
  194. Jason Bobier
  195. k059509@kzoo.edu
  196.  
  197. Politics is like beef stew; if you don't keep stirring it up, all of the greasy
  198. scum rises to the top.
  199. 
  200. 
  201. Path: ucivax!gateway
  202. From: dickie@math.wisc.edu (Garth Dickie)
  203. Subject: Re: Virtual Functions
  204. Message-ID: <9212031542.AA17308@schaefer.math.wisc.edu>
  205. Newsgroups: fa.think-c
  206. Lines: 20
  207. Date: 3 Dec 92 15:46:32 GMT
  208.  
  209. Per Mildner writes:
  210.     This is not correct. Firstly, vtables isn't "scanned" they are indexed,
  211.     i.e., one addition and one dereference to access a particular method (for
  212.     single inheritance at least)). Secondly, "virtual" doesn't NECESSARILY
  213.     disable "inline", inline expansion can be done when the compiler knows
  214.     about the runtime class of an object already at compile time (e.g., stack
  215.     allocated objects in local scope). I belive e.g. Borland does this.
  216.  
  217. Unfortunately, the original writer *was* correct, for Think C.  If you
  218. trace through method dispatch, you find that it uses a sort of "vlist".
  219. Each class has a table of pairs, index/method.  When you dispatch on an
  220. index, it scans the table for the index.  If not found, it then chains
  221. to the parent class, and scans its table for the index.
  222.  
  223. It appears to be a (questionable, in my eyes) time/space tradeoff.  With large
  224. class heierarchies, such as TCL, you could end up with huge amounts of space
  225. taken by vtables.  Perhaps as much as 32 or 64K.  I would certainly like to
  226. see a vtable option in a future version.
  227.  
  228.  -- garth dickie, dickie@math.wisc.edu
  229. 
  230. 
  231. Path: ucivax!gateway
  232. From: jum@helios.de (Jens-Uwe Mager)
  233. Subject: Re: Think C 6.0
  234. Message-ID: <9212031735.AA13972@ibm.helios.de>
  235. Newsgroups: fa.think-c
  236. Lines: 24
  237. Date: 3 Dec 92 17:38:59 GMT
  238.  
  239. >Let me see if I have my facts straight.
  240. >1. Bedrock is due out at the beginning of next year.
  241. >2. Bedrock is going to be a C++ library.
  242. >3. Think C 5.04 is not a C++ compiler.
  243. >
  244. >Therefore since Think C and Bedrock are both made by Symentic, more than
  245. >likely Think C 6.0 will include a C++ compiler and will be out around the
  246. >beginning of next year.  :-)
  247.  
  248. I suspect they will feature their Zortech compiler, which already is
  249. C++. This is not what I want, but probably their financial controller.
  250.  
  251. Best Regards,
  252. Jens-Uwe Mager
  253.  
  254. HELIOS Software GmbH
  255. Lavesstr. 80
  256. 3000 Hannover 1
  257. Germany
  258.  
  259. Phone:        +49 511 3681093
  260. FAX:        +49 511 3681095
  261. AppleLink:    ger.xse0082    Attn: Jens-Uwe Mager
  262. uucp:        jum@helios.de    or heliosd!jum
  263. 
  264. 
  265. Path: ucivax!gateway
  266. From: David.M.Tillinghast@dartmouth.edu
  267. Subject: unsubscribing
  268. Message-ID: <2128498@blitzen.Dartmouth.EDU>
  269. Newsgroups: fa.think-c
  270. Lines: 6
  271. Date: 3 Dec 92 17:55:30 GMT
  272.  
  273. Hello. I'm sorry for bothering everyone, but I was hoping someone could post
  274. the address to which we must send mail to unsubscribe to this list. It seems
  275. I've lost the original readme.
  276.  
  277. Sorry for the hassle,
  278. -tig
  279. 
  280. 
  281. Path: ucivax!gateway
  282. From: JOSTEISV@dhhalden.no (Jostein Svendsen)
  283. Subject: Programming Quicktime
  284. Message-ID: <MAILQUEUE-101.921204084912.288@sofus.dhhalden.no>
  285. X-mailer: Pegasus Mail v2.3 (R3).
  286. Newsgroups: fa.think-c
  287. Organization: Ostfold College
  288. Lines: 14
  289. Date: 4 Dec 92 07:49:54 GMT
  290.  
  291. Where can I find the information or sourcecode I need to write my own
  292. Quicktime movieplayer or XCMD?
  293.  
  294. I have looked in Inside Macintosh vol I - VI, but Quicktime is not
  295. documented here.
  296.  
  297. Jostein :-D
  298. ------------------------------------------------------------------------------
  299. The trouble with being poor is that it takes up all your time.
  300. ==============================================================================
  301. | Jostein Svendsen                      |                         PO Box 587 |
  302. | <josteisv@sofus.dhhalden.no>          |                      N-1754 HALDEN |
  303. | CS-Student, Ostfold Regional College  |                             NORWAY |
  304. ==============================================================================
  305. 
  306. 
  307. Path: ucivax!gateway
  308. From: dnebing@andy.bgsu.edu
  309. Subject: Dialog Problems
  310. Message-ID: <9212100931.AA20947@andy.bgsu.edu>
  311. Newsgroups: fa.think-c
  312. Lines: 288
  313. Date: 10 Dec 92 09:32:26 GMT
  314. X-Attachments: :Hard Disk:11501:main.c: :Hard Disk:11501:a. .r:
  315.  
  316.  
  317.   In the code that follows, I am implementing a modal dialog
  318. that contains a scroll bar and 12 strings.  The scroll bar is
  319. included so that I can display more than 12 strings overall.
  320.  
  321.   That is how the code should work, but it doesn't.  I get an
  322. illegal instruction notice when I run it in the debugger
  323. before I have a chance to do anything to the dialog.
  324.  
  325.   If someone can show me the error in my ways, please feel free
  326. to do so.
  327.  
  328.   Dave Nebinger
  329.  
  330. P.S.  Yes, I know the code is not pretty, but this is how it
  331. got thrown together.  Thanks in advance...
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340. /*
  341.             Procedure:         Signature
  342.             Purpose:           To print the signature file for David Nebinger
  343. */
  344.  
  345. void Signature(void){
  346.             printf("%s\n%s                %s\n%s\n%s\n",
  347.                        "Dave Nebinger",
  348.                        "dnebing@andy.bgsu.edu",
  349.                        "dnebing@opie.bgsu.edu",
  350.                        "Just because something is said to lighten a subject,",
  351.                        "doesn't mean the subject is taken lightly.");
  352. }
  353.  
  354. #define ContMin 1
  355. #define ContMax 4
  356. #define ArraySize 15
  357.  
  358. DialogPtr dialog;
  359. Rect scr,ir;
  360. ControlHandle scroll,ih;
  361. int it,hit;
  362. Str255 strs[ArraySize];
  363.  
  364. static pascal Boolean filter(DialogPtr dlg,EventRecord* evt,int* item);
  365. static pascal void ScrollProc (ControlHandle theControl, int theCode);
  366. static pascal void boxer(WindowPtr w,int item);
  367. static pascal void defaultbox(WindowPtr w,int item);
  368.  
  369. main(){
  370.     int i;
  371.  
  372.     InitGraf(&thePort);
  373.     InitFonts();
  374.     InitWindows();
  375.     InitMenus();
  376.     TEInit();
  377.     InitDialogs(0L);
  378.     InitCursor();
  379.  
  380.     dialog=GetNewDialog(128,0L,(WindowPtr)-1L);
  381.  
  382.     dialog->txFont=geneva;
  383.     dialog->txSize=12;
  384.  
  385.     GetDItem(dialog,2,&it,&ih,&scr);
  386.  
  387.     scroll= NewControl((WindowPtr)dialog, &scr, "\p", 1,ContMin,
  388.         ContMin,ContMax,scrollBarProc|useWFont, 0L);
  389.  
  390.     SetDItem(dialog,2,it,scroll,&scr);
  391.  
  392.     for (i=1;i<ArraySize+1;i++)
  393.         GetIndString(strs[i],128,i);
  394.  
  395.     Sets(1);
  396.  
  397.     GetDItem(dialog,15,&it,&ih,&ir);
  398.     SetDItem(dialog,15,it,defaultbox,&ir);
  399.  
  400.     GetDItem(dialog,16,&it,&ih,&ir);
  401.     SetDItem(dialog,16,it,boxer,&ir);
  402.  
  403.     do{
  404.         ModalDialog(filter,&hit);
  405.         switch(hit){
  406.             case 2:
  407.                 break;
  408.         }
  409.     } while (hit!=1);
  410. }
  411.  
  412. static pascal Boolean filter(DialogPtr dlg,EventRecord *evt,int *item){
  413.     int res;
  414.  
  415.     if ((evt->what!=keyDown)&&(evt->what!=mouseDown))
  416.         return false;
  417.  
  418.     res=0;
  419.  
  420.     if (evt->what==keyDown){
  421.         switch((evt->message)&charCodeMask){
  422.             case 0x0d: // possible keypresses for return key
  423.             case 0x03:
  424.                 *item=1;
  425.                 res=1;
  426.                 break;
  427.         }
  428.     } else
  429.         res=DoContent((WindowPtr)dlg,evt);
  430.  
  431.     if (res)
  432.         return true;
  433.     else
  434.         return false;
  435. }
  436.  
  437. static pascal void ScrollProc (ControlHandle theControl, int theCode){
  438.     int    pageSize;
  439.     int    scrollAmt;
  440.     int oldCtl;
  441.  
  442.     if (theCode == 0)
  443.         return ;
  444.  
  445.     pageSize = ContMax-ContMin;
  446.  
  447.     switch (theCode) {
  448.         case inUpButton:
  449.             scrollAmt = -1;
  450.             break;
  451.         case inDownButton:
  452.             scrollAmt = 1;
  453.             break;
  454.         case inPageUp:
  455.             scrollAmt = -pageSize;
  456.             break;
  457.         case inPageDown:
  458.             scrollAmt = pageSize;
  459.             break;
  460.     }
  461.  
  462.     oldCtl = GetCtlValue(theControl);
  463.     SetCtlValue(theControl, oldCtl+scrollAmt);
  464.  
  465.     Sets(oldCtl+scrollAmt);
  466.  
  467. }
  468.  
  469. int Sets(int first){
  470.     int i;
  471.     int j;
  472.     Handle h;
  473.     Rect r;
  474.  
  475.     for (i=1;i<13;i++){
  476.         GetDItem(dialog,2+i,&j,&h,&r);
  477.         SetIText(h,strs[first+i-1]);
  478.     }
  479. }
  480.  
  481. int DoContent(WindowPtr theWindow, EventRecord *theEvent){
  482.     int                cntlCode;
  483.     ControlHandle     theControl;
  484.     int                pageSize;
  485.     GrafPtr            savePort;
  486.     int val;
  487.  
  488.     GetPort(&savePort);
  489.     SetPort(theWindow);
  490.  
  491.     GlobalToLocal(&theEvent->where);
  492.     if ((cntlCode = FindControl(theEvent->where, theWindow, &theControl)) !=
  493. 0) {
  494.         if (cntlCode == inThumb) {
  495.             TrackControl(theControl, theEvent->where, 0L);
  496.             val=GetCtlValue(theControl);
  497.             Sets(val);
  498.         } else
  499.             TrackControl(theControl, theEvent->where, &ScrollProc);
  500.     }
  501.  
  502.     SetPort(savePort);
  503.     return cntlCode;
  504.  
  505. }
  506.  
  507. static pascal void boxer(WindowPtr dlg,int item){
  508.     Rect ir;
  509.     Handle ih;
  510.     int it;
  511.  
  512.     GetDItem(dlg,16,&it,&ih,&ir);
  513.     PenSize(1,1);
  514.     FrameRect(&ir);
  515. }
  516.  
  517. static pascal void defaultbox(WindowPtr dlg,int item){
  518.     Rect ir;
  519.     Handle ih;
  520.     int it;
  521.  
  522.     GetDItem(dlg,1,&it,&ih,&ir);
  523.     PenSize(3,3);
  524.     InsetRect(&ir,-4,-4);
  525.     FrameRoundRect(&ir,16,16);
  526. }
  527.  
  528. data 'DLOG' (128) {
  529.     $"004B 0026 0132 01CB 0002 0100 0000 0000"            /* .K.&.2. ........
  530. */
  531.     $"0000 0080 00"                                       /* ...A. */
  532. };
  533.  
  534. data 'DITL' (128) {
  535.     $"0010 0000 0000 005F 0157 0073 0191 0402"            /* ......._.W.s.e..
  536. */
  537.     $"4F4B 0000 0000 0006 0131 00C3 0140 0000"            /* OK.......1. .@..
  538. */
  539.     $"0000 0000 000A 0013 001A 012D 080B 5374"            /* ...........-..St
  540. */
  541.     $"6174 6963 2054 6578 7400 0000 0000 0019"            /* atic Text.......
  542. */
  543.     $"0013 0029 012D 080B 5374 6174 6963 2054"            /* ...).-..Static T
  544. */
  545.     $"6578 7400 0000 0000 0028 0013 0038 012D"            /* ext......(...8.-
  546. */
  547.     $"080B 5374 6174 6963 2054 6578 7400 0000"            /* ..Static Text...
  548. */
  549.     $"0000 0037 0013 0047 012D 080B 5374 6174"            /* ...7...G.-..Stat
  550. */
  551.     $"6963 2054 6578 7400 0000 0000 0046 0013"            /* ic Text......F..
  552. */
  553.     $"0056 012D 080B 5374 6174 6963 2054 6578"            /* .V.-..Static Tex
  554. */
  555.     $"7400 0000 0000 0055 0013 0065 012D 080B"            /* t......U...e.-..
  556. */
  557.     $"5374 6174 6963 2054 6578 7400 0000 0000"            /* Static Text.....
  558. */
  559.     $"0064 0013 0074 012D 080B 5374 6174 6963"            /* .d...t.-..Static
  560. */
  561.     $"2054 6578 7400 0000 0000 0073 0013 0083"            /*  Text......s...E
  562. */
  563.     $"012D 080B 5374 6174 6963 2054 6578 7400"            /* .-..Static Text.
  564. */
  565.     $"0000 0000 0082 0013 0092 012D 080B 5374"            /* .....C...i.-..St
  566. */
  567.     $"6174 6963 2054 6578 7400 0000 0000 0091"            /* atic Text......e
  568. */
  569.     $"0013 00A1 012D 080B 5374 6174 6963 2054"            /* ... .-..Static T
  570. */
  571.     $"6578 7400 0000 0000 00A0 0013 00B0 012D"            /* ext...... ... .-
  572. */
  573.     $"080B 5374 6174 6963 2054 6578 7400 0000"            /* ..Static Text...
  574. */
  575.     $"0000 00AF 0013 00BF 012D 080B 5374 6174"            /* ... ... .-..Stat
  576. */
  577.     $"6963 2054 6578 7400 0000 0000 005B 0153"            /* ic Text......[.S
  578. */
  579.     $"0077 0194 0000 0000 0000 0006 000E 00C3"            /* .w.i...........
  580. */
  581.     $"0131 0000 0000 0000 00CC 0013 00DC 0140"            /* .1....... .....@
  582. */
  583.     $"880B 5374 6174 6963 2054 6578 7400"                 /* a.Static Text. */
  584. };
  585.  
  586. data 'STR#' (128) {
  587.     $"000F 0573 7472 2031 0573 7472 2032 0573"            /* ...str 1.str 2.s
  588. */
  589.     $"7472 2033 0573 7472 2034 0573 7472 2035"            /* tr 3.str 4.str 5
  590. */
  591.     $"0573 7472 2036 0573 7472 2037 0573 7472"            /* .str 6.str 7.str
  592. */
  593.     $"2038 0573 7472 2039 0673 7472 2031 3006"            /*  8.str 9.str 10.
  594. */
  595.     $"7374 7220 3131 0673 7472 2031 3206 7374"            /* str 11.str 12.st
  596. */
  597.     $"7220 3133 0673 7472 2031 3406 7374 7220"            /* r 13.str 14.str
  598. */
  599.     $"3135"                                               /* 15 */
  600. };
  601.  
  602.  
  603.  
  604. 
  605. 
  606. Path: ucivax!gateway
  607. From: jimlynch@netcom.com (Jim Lynch)
  608. Subject: GNU C++
  609. Message-ID: <9212101535.AA19046@netcom2.netcom.com>
  610. Newsgroups: fa.think-c
  611. Lines: 35
  612. Date: 10 Dec 92 15:35:55 GMT
  613.  
  614. In mailing list TCL-TALK@BROWNVM.brown.edu, "David J. Harr" <wirehead@CHESHIRE.OXY.EDU> said:
  615. >>>>>
  616. A group of people at Apple are working on implementing a
  617. version of GCC 2.x that runs under MPW and compiles Mac
  618. code. Eventually, it is planned to include g++ in the
  619. distribution, but that is a ways down the road. For more
  620. information, and the current status of the project,
  621. contact Stan Shebs in Apple ATG, shebs@taurus.apple.com.
  622. <<<<<
  623.  
  624. Thanks David... I have read Apple's "Experiences [so far - JL] of porting GCC
  625. to the Mac" (or some such), which Stan may have written -- they were doing
  626. some strange stuff to the compiler to get it to produce the right code for MPW
  627. assembler, things like modifying the compiler (instead of the machine
  628. description) to make it produce the variable declarations before the code.
  629.  
  630. I have some other ideas, such as doing a more direct port and using GAS (GNU
  631. assembler) and changing the m68k machine description so it produces 16-bit
  632. PC-relative code and using either A5 or A4 as an index register for references
  633. to data.
  634.  
  635. Another idea I have is to make a simple app which would use the Communications
  636. Toolbox and a terminal emulator and reserve perhaps 4-8 megs of RAM for a UNIX
  637. or GNU program space and be able to use the Communications Toolbox as a UNIX
  638. pipe or stream in order to talk to some VT-100 terminal emulator. That way,
  639. I can have my Mac and GNU it too.
  640.  
  641. The reason I raise this here and the reason it's relavent (sp?) is that it
  642. would be nice to have a high-quality C++ around for when Bedrock shows up,
  643. should it not be prohibitively expensive and should it have _compilable_
  644. source.
  645.  
  646. Has anyone done a more direct port?
  647.  
  648. -Jim
  649. 
  650. 
  651. Path: ucivax!gateway
  652. From: russne@catseq.catlin.edu (Russ Nelson)
  653. Subject: ShutDownInstall()
  654. Message-ID: <Pine.2.27-experimental.9212100859.A26357@catseq.catlin.edu>
  655. Content-Type: TEXT/PLAIN; charset=US-ASCII
  656. Mime-Version: 1.0
  657. Newsgroups: fa.think-c
  658. Lines: 24
  659. Date: 10 Dec 92 16:35:48 GMT
  660.  
  661.   Could someone either point me to helpful documentation on the ShutDown
  662. Manager and how to use it (other than Inside Mac), or explain how? I am
  663. trying to make an application that, when run, installs a procedure in the
  664. shutdown queue. So far, I have compiled the procedure and have it stored
  665. in a resource in my application. When I want to install it, I load it into
  666. a Handle using GetResource(blah), MoveHHi(blah), HLock(blah), and feed it
  667. to ShutDownInstall().
  668.  
  669.   The procedure needs to find the default preferences folder, open the
  670. resource fork of it's pref file, and dump a piece of memory to the file.
  671. Nothing too complex. I had it running as an app before I compiled it to a
  672. resource, and it worked fine.=
  673.  
  674.   My computer ends up with a Bad F-Line Instruction (I think, I'm not at
  675. it right now) when I try to shut down. I remembered to make sure the
  676. procedure was declared as a pascal procedure. I'm not sure if it's the
  677. procedure at fault, or if it's the way I am trying to install it.
  678.  
  679. Thanks in advance,
  680.   Russ
  681.  
  682. Russ Nelson   *  internet:  russne@catseq.catlin.edu  *   bitnet:  nelson@catlin
  683. ->This came directly from a computer and is not to be doubted or disbelieved.<-
  684.  
  685. 
  686. 
  687. Path: ucivax!gateway
  688. From: franklin@eecs.ucdavis.edu (Paul Franklin)
  689. Subject: Re: GNU C++
  690. Message-ID: <9212101926.AA17420@endive.eecs.ucdavis.edu>
  691. In-Reply-To: Your message of "10 Dec 92 15:35:55 PST."
  692.              <9212101535.AA19046@netcom2.netcom.com>
  693. Newsgroups: fa.think-c
  694. Reply-To: franklin@ece.ucdavis.edu
  695. Lines: 30
  696. Date: 10 Dec 92 19:26:32 GMT
  697.  
  698.  
  699. Your message dated: 10 Dec 92 15:35:55 PST
  700. >
  701. >The reason I raise this here and the reason it's relavent (sp?) is that it
  702. >would be nice to have a high-quality C++ around for when Bedrock shows up,
  703. >should it not be prohibitively expensive and should it have _compilable_
  704. >source.
  705. >
  706. >Has anyone done a more direct port?
  707.  
  708. Read TidBITS #149 for more information about TopSoft; they are
  709. currently attempting a port.  Here's the part mentioning GCC v. 2.
  710.  
  711.   TopSoft is also working on another ambitious project at this time.
  712.   TopSoft C is a fully-featured C/C++ compiler, based on Eric Sink's
  713.   freeware Harvest C along with Stan Shebbs's and Brent Pease's port
  714.   of the Free Software Foundation's GCC version 2.
  715.  
  716. That's about all I know.  The rest of the TidBITS article says a bit
  717. about what TopSoft is (a nonprofit entity), as well as their
  718. almost-released product FitlerTop, which is being released with C
  719. source code that users can supposedly recompile with Think C 5.0 or
  720. MPW C++.
  721.  
  722. I'd be glad to mail anyone a copy of the article in TidBITS #149, if I
  723. see a lot of interest, I'll post the entire article.  (However, maybe
  724. there's someone here on the list who knows a bit more about TopSoft
  725. who'd do a better job of saying what it is.)
  726.  
  727. --Paul Franklin
  728. 
  729. 
  730. Path: ucivax!gateway
  731. From: toontown!uogs@sequent.com (Omer Samman)
  732. Subject: Unix mmap/munmap
  733. Message-ID: <9212102005.AA25242@toontown.oceor>
  734. Newsgroups: fa.think-c
  735. Lines: 14
  736. Date: 10 Dec 92 20:07:29 GMT
  737.  
  738.  
  739. Hi,
  740.  
  741. I am porting a unix program which makes use of the OS functions mmap() and
  742. munmap() to the Mac. The program heavily uses these functions to do internal
  743. memory management (i.e., the memory is taken from one user and given to
  744. another as the programs is running).
  745.  
  746. I need to implement simillar functionality. Is it possible? and How can it be
  747. done?
  748.  
  749. Thanks in advance for any kind of help
  750.  
  751. Omer
  752. 
  753. 
  754. Path: ucivax!gateway
  755. From: swenson%john.Berkeley.EDU@ucbvax.berkeley.edu (Kirk Swenson)
  756. Subject: Re: ShutDownInstall()
  757. Message-ID: <9212102206.AA02401@john.berkeley.edu>
  758. Newsgroups: fa.think-c
  759. Lines: 20
  760. Date: 10 Dec 92 22:14:08 GMT
  761.  
  762. Russ Nelson writes:
  763.  
  764. >  Could someone either point me to helpful documentation on the ShutDown
  765. >Manager and how to use it (other than Inside Mac), or explain how? I am
  766. >trying to make an application that, when run, installs a procedure in the
  767. >shutdown queue. So far, I have compiled the procedure and have it stored
  768. >in a resource in my application. When I want to install it, I load it into
  769. >a Handle using GetResource(blah), MoveHHi(blah), HLock(blah), and feed it
  770. >to ShutDownInstall().
  771.  
  772. Applications quit before the ShutDown Manager takes over, so the shutdown
  773. procedure must be loaded into the system heap.  It sounds like you're
  774. loading it into your application's heap, which doesn't exist when the
  775. shutdown procedure runs.  Also, you must call DetachResource so that the
  776. resource isn't disposed when your application quits.  Hope this helps.
  777.  
  778. Kirk Swenson
  779. UC Berkeley
  780. swenson@john.berkeley.edu
  781.  
  782. 
  783. 
  784. Path: ucivax!gateway
  785. From: LAFARCIOLA@ichcmns.cmns.mnegri.it (max)
  786. Subject: (none)
  787. Message-ID: <B0FB1F9DB4FF200E2E@ichcmns.cmns.mnegri.it>
  788. Content-transfer-encoding: 7BIT
  789. Newsgroups: fa.think-c
  790. X-VMS-To: in%"think-c@ics.uci.edu"
  791. Lines: 8
  792. Date: 11 Dec 92 16:51:02 GMT
  793.  
  794.  Could someone either point me to helpful documentation (sources,books,etc...)
  795.  on the Client-Server applications and how to implement them for Macintosh-Vax
  796.  platform ?
  797.  Thanks in advance,
  798.             Massimo La Farciola
  799.  
  800. E-Mail:lafarciola@ichcmns.cmns.mnegri.it
  801.  
  802. 
  803. 
  804. Path: ucivax!gateway
  805. From: k044477@hobbes.kzoo.edu ("Jamie R. McCarthy")
  806. Subject: Profiling--what gotchas are there?
  807. Message-ID: <9212111840.AA21679@hobbes.kzoo.edu>
  808. X-Mailer: ELM [version 2.3 PL11]
  809. Newsgroups: fa.think-c
  810. Lines: 19
  811. Date: 11 Dec 92 18:38:12 GMT
  812.  
  813. First of all, applause to the Think C team for including the easy,
  814. powerful profiling tool that they did.  It only took about three hours
  815. of reading and coding before I started getting complete, precise
  816. profiles of exactly the section of code that I wanted.  I like that.
  817.  
  818. I've figured out (after trial and many errors) that I don't want to
  819. gathering profile information about interrupt-level functions.  I'm not
  820. really sure why, because there's no memory moving going on, but I'll
  821. take this on faith.  (If I'm not mistaken, it's even dangerous to have
  822. profiling turned on for interrupt-time function when _profile is 0.
  823. Looking at the code, this baffles me--but it's hard to argue with a
  824. system crash.)
  825.  
  826. Is there anything else I should know about profiling?  Anything at all?
  827. --
  828.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  829.  "As you should know by now, we're strong believers in the Apple II
  830.   and always will be.  But we can't ignore reality forever."
  831.     - Tom Weishaar
  832. 
  833. 
  834. Path: ucivax!gateway
  835. From: russne@catseq.catlin.edu (Russ Nelson)
  836. Subject: More ShutDown questions
  837. Message-ID: <Pine.2.27-experimental.9212111222.A18030@catseq.catlin.edu>
  838. Content-Type: TEXT/PLAIN; charset=US-ASCII
  839. Mime-Version: 1.0
  840. Newsgroups: fa.think-c
  841. Lines: 20
  842. Date: 11 Dec 92 20:30:43 GMT
  843.  
  844. Well, I seem to have solved the problem of my procedure crashing my Mac.
  845. The problem was that I forgot to call DetachResource(theProc). Now, I have
  846. a new problem. The procedure, when compiled as a seperate application,
  847. builds the resource in its prefs file just fine, but when run as a code
  848. resource from another application (or in this case, the shutdown manager),
  849. the resource fork of its prefs file is somehow scrambled. When opening the
  850. file, ResEdit says there were minor probs with the file that have now been
  851. corrected, and the resultant file is empty. If anyone knows what might be
  852. causing this, please let me know. If it doesn't ring a bell, I could post
  853. the source; it's only about 2 pages.
  854.  
  855. Thanks again
  856. Russ
  857.  
  858.  
  859. P.S.  Thanks to everyone who responded to my last problem.
  860.  
  861. Russ Nelson   *  internet:  russne@catseq.catlin.edu  *   bitnet:  nelson@catlin
  862. ->This came directly from a computer and is not to be doubted or disbelieved.<-
  863.  
  864. 
  865. 
  866. Path: ucivax!gateway
  867. From: pchang@cs.stanford.edu (The Weasel)
  868. Subject: Re: GNU C++
  869. Message-ID: <9212102138.AA04103@Xenon.Stanford.EDU>
  870. In-Reply-To: <9212101926.AA17420@endive.eecs.ucdavis.edu>; from "Paul Franklin" at Dec 10, 92 7:26 pm
  871. X-Mailer: ELM [version 2.3 PL11]
  872. Newsgroups: fa.think-c
  873. Lines: 23
  874. Date: 11 Dec 92 21:33:37 GMT
  875.  
  876. I sure that someone else from TopSoft could do a better job than me, but
  877. since I am sort of working on porting Mr. Shebbs' MPW gcc port to a
  878. standalone I guess I can say something of value.
  879.  
  880. TopSoft was created by a group of internetters who wanted to learn
  881. some more about the mac, and have fun while doing it. After a bit of
  882. thought we settled on the FilterTop project. There are a few other
  883. projects floating about, but that is the biggie right now.
  884.  
  885. Some of us are working with Er-c Sink's Harvest C compiler to try
  886. to extend it so that it is robust, and that it includes the gcc
  887. stuff that stan is working on.
  888.  
  889. Well, I guess I don't have that much to say afterall. If someone out
  890. there, Steve?? are you there, wants to add something I think that
  891. that would be good.
  892.  
  893. Peter
  894. --
  895. Peter Chang                     |  "To absent friends, lost loves, old gods,
  896. E-Mail: pchang@cs.stanford.edu  |   and the season of the mists; and may
  897. Snail Mail: PO Box 9603         |   each and every one of us give the devil
  898.             Stanford, CA  94309 |   his due" - Hob Gadling - Sandman
  899. 
  900. 
  901. Path: ucivax!gateway
  902. From: iom@dsunx1.dsrd.ornl.gov (MIKOLIC-TORREI I)
  903. Subject: Finding a remote app using PPCToolbox (Q)
  904. Message-ID: <9212121857.AA24678@dsunx1.DSRD.ORNL.GOV>
  905. Newsgroups: fa.think-c
  906. Lines: 161
  907. Date: 12 Dec 92 18:58:07 GMT
  908.  
  909.  
  910. Hello,
  911.  
  912. A couple of questions related to finding an app on a remote machine
  913. over AppleTalk.
  914.  
  915. I want to send a high-level event to an app running on another Mac.
  916. Page 5-23 of IM-6 says that to find that app, you use the IPCListPorts()
  917. function (I don't want to use PPCBrowser()--my program needs to find the
  918. other app all by itself).
  919.  
  920. Page 7-22 of IM-6 describes IPCListPorts() and says that I first need to
  921. use GetZoneList() or GetLocalZones() to build a zone list, then PLookupName()
  922. to obtain a list of computers in those zones, and finally IPCListPorts() to
  923. find the ports (a.k.a. applications) on those computers.
  924.  
  925. Problem 1:
  926.  
  927. GetZoneList(), GetLocalZones(), and even GetMyZone() always return error
  928. noBridgeErr "No router is available".  What does this mean?  Does this mean
  929. that I only have my local, default zone (which is true:  my home network
  930. consists of a Mac IIci and a Mac+, that's it)?  Or do I need to initialize
  931. something somehow?
  932.  
  933. Problem 2:
  934.  
  935. By using the default zone wildcard character, I can successfully use
  936. PLookupName() and IPCListPorts() to find my app on the other machine
  937. __if I specify the app by name__.
  938.  
  939. However, if I try to specify my app by creator and type (which is what I
  940. really *want* to do), IPCListPorts() fails to find anything.
  941.  
  942.  
  943. The code follows.  Sorry if this is some trivial mistake, but I've never
  944. dealt with AppleTalk and the PPCToolbox before (except as a user of Sys7
  945. file sharing ;)
  946.  
  947. Thanks in advance
  948.  
  949. Igor Mikolic-Torreira
  950.  
  951. igormt@alumni.caltech.edu
  952.  
  953.  
  954. ****Code follows*****
  955.  
  956. void DoTest( WindowPtr wp )
  957. {
  958.     XPPParamBlock       myXPPPB;
  959.     MPPParamBlock       myMPPPB;
  960.     LocationNameRec     theLocationNameRec;
  961.     PortInfoRec         thePortInfoRec;
  962.     IPCListPortsPBRec   theIPCListPortsPBRec;
  963.     PortInfoRec         thePortInfoArray[30];
  964.     EntityName          theEntity;
  965.     AddrBlock           theAddrBlock;
  966.     char                myEntityName[100];
  967.     char                zoneList[578];
  968.     char                myZoneName[33];
  969.     char                returnList[5000];
  970.     OSErr               myErr = noErr;
  971.     short               xppRefnum, i;
  972.  
  973.     SetPort( wp );
  974.     EraseRect( &wp->portRect );
  975.     MoveTo( 10, 20 );
  976.     DrawString( "\pTesting finding the other Time Sync App..." );
  977.  
  978.  
  979.     /* FIRST TRY TO FIND THE ZONE(S) */
  980.  
  981.     /* Set up Parameter block for GetLocalZones() */
  982.  
  983.     myXPPPB.XCALL.xppTimeout = 3;
  984.     myXPPPB.XCALL.xppRetry = 4;
  985.     myXPPPB.XCALL.zipLastFlag = 0;
  986.     myXPPPB.XCALL.zipInfoField[0] = myXPPPB.XCALL.zipInfoField[1] = 0;
  987.     myXPPPB.XCALL.zipBuffPtr = zoneList;
  988.  
  989.     while ( myXPPPB.XCALL.zipLastFlag == 0 && myErr == noErr )
  990.     {
  991.         myErr = GetLocalZones( &myXPPPB, FALSE );   /* returns noBridgeErr */
  992.         Debugger();
  993.     }
  994.  
  995.     /* Set up Parameter block for GetMyZone() */
  996.  
  997.     myXPPPB.XCALL.xppTimeout = 3;
  998.     myXPPPB.XCALL.xppRetry = 4;
  999.     myXPPPB.XCALL.zipInfoField[0] = myXPPPB.XCALL.zipInfoField[1] = 0;
  1000.     myXPPPB.XCALL.zipBuffPtr = myZoneName;
  1001.  
  1002.     myErr = GetMyZone( &myXPPPB, FALSE );           /* returns noBridgeErr */
  1003.     Debugger();
  1004.  
  1005.  
  1006.     /* NEXT TRY TO FIND COMPUTERS IN A ZONE, AND MY APPL ON THAT MACHINE */
  1007.  
  1008.     /* Set up Parameter block for PLookupName() */
  1009.  
  1010.     NBPSetEntity( myEntityName, (Ptr) "\p=", (Ptr) "\pPPCToolBox", (Ptr) "\p*"
  1011. );
  1012.     myMPPPB.NBP.interval = 8;
  1013.     myMPPPB.NBP.count = 4;
  1014.     myMPPPB.NBP.NBPPtrs.entityPtr = myEntityName;;
  1015.     myMPPPB.NBP.parm.Lookup.retBuffPtr = returnList;
  1016.     myMPPPB.NBP.parm.Lookup.retBuffSize = 500;
  1017.     myMPPPB.NBP.parm.Lookup.maxToGet = 10;
  1018.  
  1019.     myErr = PLookupName( &myMPPPB, FALSE );
  1020.     Debugger();
  1021.  
  1022.     /* Set up Parameter block for IPCListPorts() */
  1023.  
  1024.     theLocationNameRec.locationKindSelector = ppcNBPLocation;
  1025.     thePortInfoRec.name.nameScript = 0;
  1026.  
  1027. #ifdef BY_NAME
  1028.                 /* This works just fine !!! */
  1029.  
  1030.     strcpy( (char *) thePortInfoRec.name.name, "Time Sync Test" );
  1031.     CtoPstr( (char *) thePortInfoRec.name.name );
  1032.     thePortInfoRec.name.portKindSelector = ppcByString;
  1033.     strcpy( (char *) thePortInfoRec.name.u.portTypeStr, "=" );
  1034.     CtoPstr( (char *) thePortInfoRec.name.u.portTypeStr );
  1035.  
  1036. #else
  1037.                 /* This fails:  IPCListPorts to return .actualCount = 0 */
  1038.  
  1039.     strcpy( (char *) thePortInfoRec.name.name, "=" );
  1040.     CtoPstr( (char *) thePortInfoRec.name.name );
  1041.     thePortInfoRec.name.portKindSelector = ppcByCreatorAndType;
  1042.     thePortInfoRec.name.u.port.creator = 'IMTt';
  1043.     thePortInfoRec.name.u.port.type = 'APPL';
  1044.  
  1045. #endif
  1046.  
  1047.     theIPCListPortsPBRec.startIndex = 0;
  1048.     theIPCListPortsPBRec.requestCount = 10;
  1049.     theIPCListPortsPBRec.portName = &(thePortInfoRec.name);
  1050.     theIPCListPortsPBRec.locationName = &theLocationNameRec;
  1051.     theIPCListPortsPBRec.bufferPtr = thePortInfoArray;
  1052.  
  1053.     for ( i = 1; i <= myMPPPB.NBP.parm.Lookup.numGotten; i++)
  1054.     {
  1055.         /* Get a list of computers (=locations) */
  1056.  
  1057.         myErr = NBPExtract( returnList, myMPPPB.NBP.parm.Lookup.numGotten, i,
  1058.                             &theEntity, &theAddrBlock );
  1059.         theLocationNameRec.u.nbpEntity = theEntity;
  1060.  
  1061.         /* See if my app (=port) is there */
  1062.  
  1063.         myErr = IPCListPorts( &theIPCListPortsPBRec, FALSE );
  1064.         Debugger();
  1065.     }
  1066.  
  1067.  
  1068.  
  1069. }
  1070. 
  1071. 
  1072. Path: ucivax!gateway
  1073. From: nagel@kithrup.irvine.ca.us ("Mark D. Nagel")
  1074. Subject: ARCHIVE: Word Services SDK
  1075. Message-ID: <0E010598.kvogms@kithrup.Irvine.CA.US>
  1076. X-Mailer: uAccess - Macintosh Release: 1.6v1
  1077. Newsgroups: fa.think-c
  1078. Reply-To: think-c-request@ics.uci.edu
  1079. Lines: 339
  1080. Date: 13 Dec 92 03:07:45 GMT
  1081.  
  1082.  
  1083. [Please send mail to D1620@applelink.apple.com if you have any
  1084.  questions about this product. -- MDN]
  1085.  
  1086. Michael D. Crawford
  1087. Working Software, Inc.
  1088. AppleLink D1620
  1089.  
  1090. Contents
  1091.  
  1092. Introduction
  1093. Helpful Hints
  1094. How it Works
  1095. The Services Menu
  1096. Initiating a Session
  1097. Changes to be Made in the Protocol and Demo Code
  1098.  
  1099. Introduction
  1100.  
  1101. This is a brief overview of the source code to the Writeswell Jr. program
  1102. that is used to demonstrate the word-processor side of the Word Services
  1103. Suite.  Writeswell Jr. is a simple TextEdit based text editor.  It is
  1104. Apple Event aware, though, and can call a spelling checker, grammar
  1105. checker, hyphenator, or other word services via the Word Services
  1106. protocol.
  1107.  
  1108. This sample code works but is not completed and does not completely match
  1109. the Word Services Suite specification.  The spec has grown and changed
  1110. with time, and so has the sample code - but they dont always match.  The
  1111. sample code is now in the 1.0 final release.  We are still awaiting the
  1112. final draft of the protocol specification from Apple.  Where there are
  1113. differences betwwen the spec and the sample code, follow the sample code
  1114. and this document.  When the final release of the Word Services
  1115. specification appears, use the specification.
  1116.  
  1117. Helpful Hints
  1118.  
  1119. Here are hints based on the experience of the other developers that have
  1120. implemented the protocol in their own applications.
  1121.  
  1122. Writeswell Jr. can be run off of a CD since it creates a preference file
  1123. on your hard disk.  IAC Spell Test will need to be on your hard disk since
  1124. it saves its dictionary location in its own resource file.
  1125.  
  1126. You must install a debugger such as Macsbug when running the Writeswell
  1127. Jr., and the IAC Spell Test speller.  If there is an error, the
  1128. applications call the debugger with a helpful error message.  If no
  1129. debugger is installed, you will get an Unimplemented A-Trap System
  1130. Error.  If an error is returned from a trap call, the command D7.W will
  1131. usually display the result code in Macsbug, and the command g will
  1132. continue execution.
  1133.  
  1134. Also, be sure you have the SIZE resource correct.  You will need the High
  1135. Level Event Aware and the Can Background bits set.  There is some
  1136. possibility that you may need to change the logic of your program slightly
  1137. if you have never used background processing before.
  1138.  
  1139. How it Works
  1140.  
  1141. The program starts in main in TestBed.c.  Main initialized the managers,
  1142. calls functions to install the various handlers, and starts up the event
  1143. loop.
  1144.  
  1145. There are two sets of Apple Event handlers.  The first set, in
  1146. MyHandlers.c, handle the required Apple Events.  These are the OAPP, ODOC,
  1147. PDOC, and QUIT handlers from the kCoreEventClass.  The one notably useful
  1148. code is MyOAPPHandler, which can open a file from disk.  You can open a
  1149. file at any time by dragging its icon onto Writeswell Jr.'s icon, as long
  1150. as Writeswell Jr. has no windows open (it can only handle a single
  1151. window).  The handler calls MyOpenFile in MyFiles.c, which calls
  1152. MakeNewWindow to create a window (with a TextEdit handle stuffed into the
  1153. window's refCon), and then reads the text from the file into the TextEdit
  1154. field.
  1155.  
  1156. The Core suite events are handled by a single "wildcard" handler,
  1157. GenericHandler in GenHandlers.c, using an "inverted" method suggested to
  1158. me by Richard Clark of Developer University.  GenericHandler extracts the
  1159. direct object from the event and calls AEResolve to identify the object
  1160. that is specified by the event, and then calls a dispatcher for the given
  1161. object type.  This allows me to neatly separate all the code for each
  1162. object class into different files for easy maintenance.  There aren't many
  1163. classes here yet, but I think this makes much more sense than having each
  1164. event handler handle the events for each class.
  1165.  
  1166. (One can be easily confused by the "kCoreEventClass" constant for the
  1167. required event class, and the "kAECoreSuite" constant for the Core Suite.)
  1168.  
  1169. The classes I support are cApplication, cWindow,  cText, and
  1170. typeObjectSpecifier.  You may get and set a windows title, and you may
  1171. count the cText and the typeObjectSpecifier elements of the window.  Note
  1172. that I use a coercion handler to convert typeChar data into "typePString"
  1173. data in order to set the window title; this is a type that would be good
  1174. to have defined in the Core suite.  The coercion handler is
  1175. TextPtrToPString in ObText.c.  Note that the window code does not "know"
  1176. about TextPtrToPString; it just asks for the data type, and gets it
  1177. because the coercion handler is present.
  1178.  
  1179. I use a trick in my token data structures.  A typical token body is as
  1180. follows:
  1181.  
  1182. typedef struct {
  1183.     TEHandle    textH;
  1184.     short        startPos;    /* Short cuz TE only handles 32k o' text! */
  1185.     short        length;
  1186.     DescType    propertyCode;
  1187. } TETextTokenBody;
  1188.  
  1189. If my object accessors are given a key form of formPropertyID, the ID is
  1190. placed in propertyCode; if they are not, then the desired data is the
  1191. object itself (the window, the text, etc., rather than the title of the
  1192. window or the font of the text), and I used a propertyCode of 'null'.
  1193. Here I make the assumption that 'null' will never be a property; this may
  1194. not be a valid assumption.  The trick is handy in my event handlers; I
  1195. just switch off the property code to determine what to do:
  1196.  
  1197. OSErr TETextSetDataHandler(... )...
  1198. switch ( propCode ){
  1199.     case typeNull:
  1200.         ...
  1201.         TEInsert( (Ptr)(*textValue.dataHandle), newTextLen, textH );
  1202.         break;
  1203.     case propBackgroundHilite:
  1204.         TESetSelect( (*tokHdl)->startPos,
  1205.                 (*tokHdl)->startPos + (*tokHdl)->length,
  1206.                 textH );
  1207.         TEActivate( textH );
  1208.         break;
  1209.     default:
  1210.             return errAENoSuchObject;
  1211.             break;
  1212. }
  1213.  
  1214. Though the Core Suite specifies a single cText class, the text in your
  1215. application may be of different types - editable text in windows,
  1216. non-editable text in menu titles or menu items and so on.  You will need a
  1217. number of different token types for your text to reflect the  different
  1218. kinds of text that you may have.
  1219.  
  1220. The key to supporting the Word Services suite is to support formRange and
  1221. end-of-container formAbsolutePosition key forms.  Specifying a position
  1222. relative to the end of the container allows the text to be changed by
  1223. several successive Set Data events without having to do extra work to
  1224. calculate new offsets.  One can tell that a formAbsolutePosition key is
  1225. relative to the end of the container because it will be negative; -1 is
  1226. the last object in the container.  See the code in CharFromTEText in
  1227. ObText.c.
  1228.  
  1229. The Object Support Library documentation is unclear about how to resolve
  1230. formRange specifiers.  Note that to specify a range of characters, we use
  1231. a formRange object specifier that consists of two formAbsolutePosition
  1232. specifiers, which specify a single character at the beginning and end of
  1233. the range.  When an object accessor recieves a formRange key, the
  1234. selectionData is a descriptor of type 'rang'.  You can coerce this to
  1235. typeAERecord, and then use AEGetKeyDesc to extract the keyAERangeStart and
  1236. keyAERangeStop object specifiers.  If you don't coerce to typeAERecord,
  1237. the call to AEGetKeyDesc will fail - it does not recognize the the 'rang'
  1238. data type is really an AERecord.  You must then call AEResolve on each of
  1239. the two specifiers to get the beginning and end of the range.  Note that
  1240. this is a recursive call - your object accessor has already been called by
  1241. AEResolve; thus object accessors must be reentrant - they must not change
  1242. global variables.
  1243.  
  1244. Following is the formRange code from CharFromTEText:
  1245.  
  1246. case formRange:
  1247.  
  1248.     err = AECoerceDesc( selectionData, typeAERecord, &rangeRecord );
  1249.     if ( err ) return err;
  1250.  
  1251.     err = AEGetKeyDesc( &rangeRecord, keyAERangeStart,
  1252.                     typeObjectSpecifier, &startSpec );
  1253.     if ( err ) return err;
  1254.  
  1255.     err = AEGetKeyDesc( &rangeRecord, keyAERangeStop,
  1256.                 typeObjectSpecifier, &endSpec );
  1257.     if ( err ) return err;
  1258.  
  1259.     err = AEResolve( &startSpec, kAEIDoMinimum, &startToken );
  1260.     if ( err ) return err;
  1261.  
  1262.     err = AEResolve( &endSpec, kAEIDoMinimum, &endToken );
  1263.     if ( err ) return err;
  1264. (... now make the token from the beginning and end tokens...)
  1265.  
  1266. The Services Menu
  1267.  
  1268. Word Services provides for a simple way to register new services with
  1269. applications.  Launch the speller (IAC Spell Test in this case).  Launch
  1270. Writeswell Jr. and select New Batch Service from the Services menu.
  1271. Select IAC Spell Test from the PPCBrowser display.
  1272.  
  1273. Writeswell Jr. sends a Get Data event to request the pBatchMenuString
  1274. property from IAC Spell Test, and another Get Data to request the
  1275. pLocation property.  The menu string is saved in the Writeswell Jr.
  1276. Preferences file, and added to the Services menu.  The pLocation is an
  1277. alias record.  IAC Spell Test places its creator code in the userType
  1278. field of the alias.  This is important - the alias manager puts 0 in the
  1279. userType - the value placed there is up to the application; the Word
  1280. Services spec requires the actual signature of the speller, so that it is
  1281. easily accessible to the word processor.
  1282.  
  1283. The preferences file also contains a record that records the type of
  1284. service for each menu item - either batch service, interactive service, or
  1285. no service.  (Interactive service is not yet implemented).  When the menu
  1286. is built, a global array, gServItemID,  stores the resource ID for each
  1287. service menu item.  When the service is selected from the menu,
  1288. OpenSpeller in DoChecking.c looks up the resource ID in gServItemID.  The
  1289. alias record is read in.  OpenSpeller calls FindAProcess to see if a
  1290. process is running with that creator code.  If it is not, then OpenSpeller
  1291. calls LaunchSpeller to launch the speller application from the alias, and
  1292. then returns a typeApplSignature descriptor for use in the AESend call to
  1293. send the batch event.
  1294.  
  1295. You can simulate the presence of multiple Word Service programs on your
  1296. hard disk.  Make several copies of the IAC Spell Test.  Use ResEdit to
  1297. give each copy a unique creator code.  Change the STR# 1300 resource to
  1298. give each one a unique menu string.  Then launch each one, and install it
  1299. in Writeswell Jr.s menu (or your own applications menu!)  Each copy of
  1300. the speller will need its own dictionary if they are to run all at the
  1301. same time.
  1302.  
  1303. The code that services the Get Data event for the pLocation property of
  1304. IAC Spell Test actually checks to see what its own creator code is.
  1305. Normally, you just use a constant, but I wanted to allow for the simulated
  1306. multiple servers.
  1307. Initiating a session
  1308.  
  1309. You may start a Word Services session by selecting Check Spelling with
  1310. IAC Spell Test from the services menu, after installing the menu item as
  1311. described above.
  1312.  
  1313. Selecting a service results in a call to DoSpellCheck in DoChecking.c.
  1314. DoSpellCheck calls OpenSpeller to look for the server, launch it if
  1315. necessary, and obtain its address as a typeApplSignature descriptor.
  1316. Then DoSpellCheck calls either DoBatchCheck or DoBatchTableCheck to send a
  1317. Batch Process My Text Apple Event to the server.  The batch event
  1318. contains a parameter that specifies what text is to be checked.  The
  1319. speller uses this parameter in subsequent Get Data and Set Data events to
  1320. read and replace the text, and to set the background hilighting.
  1321.  
  1322. There are two ways that the text may be specified in the batch event.  You
  1323. can choose which is used by selection Options from the Writeswell Jr.
  1324. Edit menu.
  1325.  
  1326. The Send text specifiers option makes Writeswell Jr. send the object
  1327. specifiers for the text explicitly.  The direct object to the batch event
  1328. is a list (a descriptor of typeAEList) which contains a single element,
  1329. which is an object specifier for the first (and only) text field in the
  1330. frontmost window.
  1331.  
  1332. Client programs that allow more than one text block, such as drawing
  1333. programs, spreadsheets, and databases, may have several blocks checked at
  1334. once by sending an object specifier to each block in the list.
  1335.  
  1336. This is easy to do and works well if there are not too many text blocks to
  1337. be checked.  It will not work if there are many text blocks, since an
  1338. Apple Event may not contain more than 64K of data.
  1339.  
  1340. The Send table specifier option sends an object specifier for a table
  1341. instead.  The direct object is a descriptor of typeObjectSpecifier.  The
  1342. server will use the table specifier as a container to ask for elements of
  1343. typeObjectSpecifier.  That is, the server will ask for object specifier
  1344. number 27, which is contained within the first window of the
  1345. application.  The object specifier that is gotten from the table is used
  1346. in just the same manner as the object specifiers that are contained in the
  1347. list from the Send text specifiers method.
  1348.  
  1349. A client application may choose to user either method.  The method used
  1350. will be invisible to the user - I allow the option here for so programmers
  1351. may test either way.  A server application must support both methods.
  1352.  
  1353. The server uses the descriptor type of the batch events direct object to
  1354. determine which method to use.  If the direct object is typeAEList, then
  1355. the server expects the direct object to contain a list of object
  1356. specifiers.  If the direct object is typeObjectSpecifier, then the server
  1357. expects that the direct object may be used access the elements of a table
  1358. that is kept within the client.
  1359.  
  1360. In the Writeswell Jr. code, the table is just the document window.  The
  1361. elements of the window that are of typeObjectSpecifier are object
  1362. specifiers to the text fields in the window that are to be spellchecked.
  1363. (Theres only one text field, but there could be more in general).  If one
  1364. uses Get Data to get the first text element in the window, the text will
  1365. be returned.  If one uses Get Data to get the first object specifier
  1366. element in the window, then an object specifier will be returned.  This
  1367. object specifier refers to the text element.
  1368.  
  1369. If you get this far, your head must be swimming.  Go have a cup of tea and
  1370. relax for a while.  You have read the words object specifier entirely
  1371. too many times.
  1372.  
  1373. It is up to you what you want to use for a container.  I chose to use a
  1374. window, but you could use the application (or null) container, or you
  1375. could use some other object.  The server does not examine the table
  1376. specifier itself; it just uses it as container to get an element from.
  1377.  
  1378. Changes to be Made in the Demo Code
  1379.  
  1380. There will be some changes in the Word Services Suite from what is done
  1381. here.
  1382.  
  1383. The menu strings will be elements of the application rather than
  1384. properties.  There will be an optional parameter added to the batch event
  1385. to specify which service is desired.  This will allow a single server
  1386. application to provide multiple services, each with their own menu string.
  1387.  
  1388. There are discussions under way on how to allow Word Services to support
  1389. servers that use modeless dialogs.  This will mainly be of use to grammar
  1390. checkers, which will be able to tell the user to rephrase some text back
  1391. in the original document, and then continue where they left off when the
  1392. user selects the grammar checkers window.  This will be an optional
  1393. capability, and will require the client to maintain some state information
  1394. during a Word Services session.
  1395.  
  1396. The other main change is the way that the background highlighting is done.
  1397.  
  1398. The current draft of the protocol says that the text which is highlit in
  1399. the background is specified to be elements of a table, so that it is
  1400. possible to show several ranges of highlit text.
  1401.  
  1402. The background hilighting is a property of a single character, as the font
  1403. and style are in the Text Suite.  The application will have a Boolean
  1404. property to allow the server to determine if the client supports disjoint
  1405. ranges.
  1406.  
  1407. 1992 Working Software, Inc.
  1408. This source code is copyrighted.  Permission is granted to use the Word
  1409. Services portion of the Writeswell Jr. source code in your own programs,
  1410. but you may not distribute the Writeswell Jr. word-processor code as a
  1411. commercial product.  If you modify the code, please do not call it
  1412. Writeswell Jr. (or Writeswell.)  This will ensure that people understand
  1413. the program and dont have to deal with a number of different versions
  1414. with who-knows-what going on in the code.
  1415.  
  1416. Writeswell Jr. and Writeswell are trademarks of Working Software, Inc.
  1417.  
  1418. /*****************************************************************************/
  1419.  
  1420. [saved as: /mac/think-c/demos/ws-sdk-1.0.hqx; 504K]
  1421. 
  1422. 
  1423. Path: ucivax!gateway
  1424. From: yarri@icrl.mew.mei.co.jp (Douglas Yarrington)
  1425. Subject: Re: GNU C++
  1426. Message-ID: <9212140619.AA10890@solbol.icrl.mew.mei.co.jp>
  1427. In-Reply-To: <9212101926.AA17420@endive.eecs.ucdavis.edu>; from "Paul Franklin" at Dec 10, 92 7:26 pm
  1428. X-Mailer: ELM [version 2.3 PL11]
  1429. Newsgroups: fa.think-c
  1430. Lines: 71
  1431. Date: 14 Dec 92 06:33:56 GMT
  1432.  
  1433. Paul Franklin writes:
  1434.  
  1435. > >The reason I raise this here and the reason is that it
  1436. > >would be nice to have a high-quality C++ around...
  1437. > >Has anyone done a more direct port?
  1438.  
  1439. > Read TidBITS #149 for more information about TopSoft; they are
  1440. > currently attempting a port.  Here's the part mentioning GCC v. 2.
  1441.  
  1442. >   TopSoft is also working on another ambitious project at this time.
  1443. >   TopSoft C is a fully-featured C/C++ compiler, based on Eric Sink's
  1444. >   freeware Harvest C along with Stan Shebbs's and Brent Pease's port
  1445. >   of the Free Software Foundation's GCC version 2.
  1446.  
  1447. > However, maybe there's someone here on the list who knows a bit
  1448. > more about TopSoft who'd do a better job of saying what it is.
  1449.  
  1450. Peter Chang writes back:
  1451.  
  1452. > TopSoft was created by a group of internetters who wanted to learn
  1453. > some more about the mac, and have fun while doing it. After a bit of
  1454. > thought we settled on the FilterTop project. There are a few other
  1455. > projects floating about, but that is the biggie right now.
  1456. >
  1457. > Some of us are working with Er-c Sink's Harvest C compiler to try
  1458. > to extend it so that it is robust, and that it includes the gcc
  1459. > stuff that stan is working on.
  1460.  
  1461. Well I'll add to this... I'm one of the founding members of TopSoft, and,
  1462. like the speil says, we're an organized group of internetters who all have
  1463. the goal of producing some useful Mac-specific software for public use in
  1464. the same spirit as Richard Stallman's Free Software Foundation.
  1465.  
  1466. We are working on a several projects, including a fully C++ compatible
  1467. compiler (TopSoftC) based on GCC. We plan to release our first product,
  1468. FilterTop, next month.
  1469.  
  1470. We have several mailing lists set up where you can get more information on
  1471. TopSoft, or on some of the specific projects. Please contact the
  1472. administrators of these lists for more info:
  1473.  
  1474. TopSoft:    ts-info@syrinx.kgs.ukans.edu
  1475.         (or try: pfterry@msmail.kgs.ukans.edu)
  1476.  
  1477. TopSoft C:    tc-info@syrinx.kgs.ukans.edu
  1478.         (or try: surak@ugcs.caltech.edu)
  1479.  
  1480. FilterTop:    ft-info@syrinx.kgs.ukans.edu
  1481.         (or try: stevej@ais.org)
  1482.  
  1483. You can also get some information on your own by contacting our ftp site at
  1484. syrinx.kgs.ukans.edu (login as anonymous), look under the ~/topsoft
  1485. directory for specific project information.
  1486.  
  1487. Or, you could always pummel me with more email :)
  1488.  
  1489. If any of you on this Think-C mailing list are interested in joining us,
  1490. let us know. We have all types of people in TopSoft, not just expert
  1491. programmers. And, best of all, we're all interested in helping each other
  1492. out. From my experience, it's been a great way to learn the nuances of Mac
  1493. programming.
  1494.  
  1495. Hope to hear from you later.
  1496.  
  1497. --douglas
  1498.  
  1499. Ho ho ho ho ho ho o<<(8o)}}>
  1500.  
  1501.   Douglas Yarrington                                 yarri@icrl.mew.mei.co.jp
  1502.   IBS Systems - Digital Design                             Flat Antenna Stuff
  1503.   Matsushita Electric Works, Ltd        "A beautiful place to be for a while"
  1504. 
  1505. 
  1506. Path: ucivax!gateway
  1507. From: Per.Mildner@csd.uu.se (Per Mildner)
  1508. Subject: Re: Finding a remote app using PPCToolbox (Q)
  1509. X-Sender: perm@meryl.csd.uu.se
  1510. Message-ID: <199212140904.AA17522@meryl.csd.uu.se>
  1511. Newsgroups: fa.think-c
  1512. X-Charset: ASCII
  1513. Lines: 7
  1514. Date: 14 Dec 92 09:04:47 GMT
  1515. X-Char-Esc: 29
  1516.  
  1517. Try looking for the name "ep01SIGN" (or maybe "SIGNep01") where SIGN is the
  1518. app signature. This is undocumented but seem to be the only way.
  1519. Per Mildner                      Preferred: Per.Mildner@CSD.UU.SE
  1520. Computing Science Dept.          AppleLink: sw1106
  1521. Uppsala University               tel: +46 18 181049
  1522. Box 311, S-751 05 Uppsala,Sweden fax: +46 18 521270
  1523.  
  1524. 
  1525. 
  1526. Path: ucivax!gateway
  1527. From: TPZ4@vm.cnuce.cnr.it (Rodolfo Cardarelli)
  1528. Subject: Yet Another Compiler Question...
  1529. Message-ID: <9212140643.aa08385@q2.ics.uci.edu>
  1530. Newsgroups: fa.think-c
  1531. Lines: 26
  1532. Date: 14 Dec 92 14:43:16 GMT
  1533.  
  1534. I apologize for asking the same old questions, about Mac Primer...
  1535. I tried to run Reminder, which is one of the small programs in the book.
  1536. The compiler, in run time, gives me the "illegal instruction" message, when
  1537. I try to place an handle on the Apple Menu to add the DRVR resources (I feel
  1538. ashamed to ask this questions...)
  1539. Anyway the piece of code looks like
  1540. MenuHandle gAppleMenu
  1541. gMyBar=GetNewMBar(400) //I haven't got all the character on this keyboard...
  1542. gAppleMenu=GetMHandle(400) //so semicolons are missing
  1543. AddResId(gAppleMenu,'DRVR')
  1544.  
  1545. The funny thing is that if I change the instruction to
  1546. gAppleMenu=GetMenu(400)
  1547. then it works| So it seems that GetNewMBar isn't calling the appropriate
  1548. GetMenu routines. I checked the code with Timer, which has a similar
  1549. structure, and everything looks ok (it always does so...)
  1550. The resource file looks alright as well
  1551. Any suggestion? And by the way, which is the difference between GetMHandle and
  1552. GetMenu? I did'n understand it verey well. Another book suggests another techn
  1553. ique, that is using InsertMenu before DrawBar
  1554. Which is working better?
  1555. Thank you for any help
  1556.  
  1557.  
  1558. Rodolfo Cardarelli
  1559. TPZ4@ICNUCEVM.CNUCE.CNR.IT
  1560. 
  1561. 
  1562. Path: ucivax!gateway
  1563. From: asaria@rrdtc.donnelley.com
  1564. Subject: ResEdit & System 7.1
  1565. Message-ID: <9212141903.AA16991@uu.psi.com>
  1566. Newsgroups: fa.think-c
  1567. Lines: 15
  1568. Date: 14 Dec 92 19:31:21 GMT
  1569.  
  1570.  
  1571. I'm asking this for one of the other developers here so I may not have all
  1572. of the facts.  He ran into trouble using ResEdit (v2.1.1) with System 7.1.
  1573. Specifically, ResEdit crashed when he tried to create a new resource and
  1574. locked up his Mac.
  1575.  
  1576. Has anybody else run into problems with ResEdit and System 7.1?  Also is
  1577. version 2.1.1 of ResEdit the latest one?
  1578.  
  1579. Please e-mail, and I'll post a summary if there is sufficient interest.
  1580.  
  1581. Thanks,
  1582.  
  1583. Riyaz Asaria
  1584. asaria@donnelley.com
  1585. 
  1586. 
  1587. Path: ucivax!gateway
  1588. From: C2MXBAR@fre.towson.edu (Aaron Barnett)
  1589. Subject: tear-off menu/windoid code?
  1590. Message-ID: <01GSBICUDFQQ9S5V95@TOE.TOWSON.EDU>
  1591. Content-transfer-encoding: 7BIT
  1592. MIME-version: 1.0
  1593. Newsgroups: fa.think-c
  1594. X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
  1595. Lines: 9
  1596. Date: 15 Dec 92 16:21:33 GMT
  1597. X-Envelope-to: think-c@ics.uci.edu
  1598.  
  1599. i found a snippit for this at apple called Windoid 1.0b2.2
  1600. looks like a great demo, does all i need to do, but its written in
  1601. a cpp/MacApp combo (greek to me) and all the base classes seem not to be
  1602. there...
  1603.  
  1604.  can someone point me to some think c code on this subject?
  1605.  
  1606. thanks
  1607.  aaron
  1608. 
  1609. 
  1610. Path: ucivax!gateway
  1611. From: ksand@apple.com
  1612. Subject: Re: tear-off menu/windoid code?
  1613. Message-ID: <9212151732.AA03635@apple.com>
  1614. Newsgroups: fa.think-c
  1615. Lines: 20
  1616. Date: 15 Dec 92 17:33:25 GMT
  1617.  
  1618. >i found a snippit for this at apple called Windoid 1.0b2.2
  1619. >looks like a great demo, does all i need to do, but its written in
  1620. >a cpp/MacApp combo (greek to me) and all the base classes seem not to be
  1621. >there...
  1622. >
  1623. > can someone point me to some think c code on this subject?
  1624.  
  1625. Well, it was my old MacApp 3.0b2 sample. Check out the Think class
  1626. library for another implementation of floating windows, also newer
  1627. releases of DTS Kibitz will have an implementation (that does not patch
  1628. all around the toolbox traps, instead it's careful about what Window
  1629. Manager traps it calls, and handles the window list itself).
  1630.  
  1631. Finally, the ultimate source to floating windows stuff is on one of the
  1632. MacTutor volumes (don't remember the exact location just now).
  1633.  
  1634. Kent
  1635. ---
  1636. ksand@apple.com
  1637.  
  1638. 
  1639. 
  1640. Path: ucivax!gateway
  1641. From: FLC3527@tamxrd.tamu.edu (Trey Campbell)
  1642. Subject: RE: Yet Another Compiler Question...
  1643. Message-ID: <921214104818.20202ea3@TAMXRD.TAMU.EDU>
  1644. Newsgroups: fa.think-c
  1645. Lines: 39
  1646. Date: 16 Dec 92 06:54:22 GMT
  1647. X-Vmsmail-To: SMTP%"fa.think-c-outbound-request@ics.uci.edu"
  1648.  
  1649. Rodolfo Cardarelli writes:
  1650.  
  1651. >I apologize for asking the same old questions, about Mac Primer...
  1652. >I tried to run Reminder, which is one of the small programs in the book.
  1653. >The compiler, in run time, gives me the "illegal instruction" message, when
  1654. >I try to place an handle on the Apple Menu to add the DRVR resources (I feel
  1655. >ashamed to ask this questions...)
  1656. >Anyway the piece of code looks like
  1657. >MenuHandle gAppleMenu
  1658. >gMyBar=GetNewMBar(400) //I haven't got all the character on this keyboard...
  1659. >gAppleMenu=GetMHandle(400) //so semicolons are missing
  1660. >AddResId(gAppleMenu,'DRVR')
  1661.  
  1662. >The funny thing is that if I change the instruction to
  1663. >gAppleMenu=GetMenu(400)
  1664. >then it works| So it seems that GetNewMBar isn't calling the appropriate
  1665. >GetMenu routines. I checked the code with Timer, which has a similar
  1666. >structure, and everything looks ok (it always does so...)
  1667. >The resource file looks alright as well
  1668. >Any suggestion? And by the way, which is the difference between GetMHandle and
  1669. >GetMenu? I did'n understand it verey well. Another book suggests another techn
  1670. >ique, that is using InsertMenu before DrawBar
  1671. >Which is working better?
  1672. >Thank you for any help
  1673.  
  1674. If the 'MBAR' resource exists and is correctly defined, your "Apple" menu
  1675. should be loaded into memory by GetNewMBar(). My understanding is that
  1676. GetMHandle() returns a handle to a 'MENU' resource that is already in memory
  1677. and returns NULL if the resource can't be found. GetMenu() is like calling
  1678. GetResource() and specifying type 'MENU.' It appears from what you've said that
  1679. the call to GetNewMBar() isn't loading your 'MENU.' I would suggest that you
  1680. check very carefully your 'MBAR' and 'MENU' resources. Remember that when you
  1681. change the resource ID of a 'MENU' you not only have to change it in the
  1682. resource info, but also the Menu ID (check the under "MENU" in ResEdit).
  1683.  
  1684. I hope this helps,
  1685.  
  1686. Trey Campbell
  1687. X-Ray Diffraction Lab, Texas A&M University
  1688. 
  1689. 
  1690. Path: ucivax!gateway
  1691. From: mdl@junior.bintec.de (Mike Lyons)
  1692. Subject: Need driver for Toshiba TXM3301E1 CD-ROM
  1693. Message-ID: <9212161704.AA00363@junior.bintec.de>
  1694. Newsgroups: fa.think-c
  1695. Lines: 29
  1696. Date: 16 Dec 92 17:11:18 GMT
  1697.  
  1698. Hi all,
  1699.  
  1700. I realize that this is only indirectly related to this group, but
  1701. my Usenet posting software is broken and I'm beoming desparate.
  1702.  
  1703. The story:
  1704.  
  1705. I just got a mailing of developer CD-ROMS from APDA but my  Apple
  1706. drive  is  kaputt.   I  snarfed the CD-ROM drive from our Silicon
  1707. Graphics Indigo.  This is a Toshiba TXM3301E1,  but  the  Toshiba
  1708. driver  for  the  Mac  that  I  found lying around only caused my
  1709. machine (Mac IIci 16 MB, System 7.0.1 tuned) to crash.  Does  an-
  1710. ybody  use   this  drive  and  have  an  up  to  date  driver and
  1711. support software for it?  If so, could  you  binhex  or  uuencode
  1712. them and e-mail them  to me?
  1713.  
  1714.  
  1715.  
  1716. Thanks in advance,
  1717.  
  1718. Mike
  1719.  
  1720. p.s. vi, nroff and elm...it almost works
  1721. --
  1722. ================================================================================
  1723. | Michael D. Lyons        | Telefon: +49 911 996750  | EMail: mdl@BinTec.DE    |
  1724. | BinTec Computersysteme  | Telefax: +49 911 6880725 |                         |
  1725. |    Willstaetter Strasse 30 /   D-8500 Nuernberg 60  /   GERMANY              |
  1726. ================================================================================
  1727. 
  1728. 
  1729. Path: ucivax!gateway
  1730. From: kirk_crawford@qmail2.aero.org (Kirk Crawford)
  1731. Subject: Think C->Windows?
  1732. Message-ID: <199212162221.AA25820@aerospace.aero.org>
  1733. Posted-Date: 16 Dec 92 14:25:07 U
  1734. Newsgroups: fa.think-c
  1735. Lines: 8
  1736. Date: 16 Dec 92 22:21:59 GMT
  1737.  
  1738. Subject:  Think C->Windows?
  1739. I heard of a program or service a while ago that will allow you to convert your
  1740. Think C source to some other C source code for Windows.  Does this still exist?
  1741.  Does anyone have the specifics on it?
  1742. -Kirk Crawford
  1743.  
  1744.  
  1745.  
  1746. 
  1747. 
  1748. Path: ucivax!gateway
  1749. From: evans@natural.com (Christopher Evans)
  1750. Subject: Mounting servers w/o users
  1751. Message-ID: <9212162105.AA17142@natural.com>
  1752. Newsgroups: fa.think-c
  1753. Lines: 17
  1754. Date: 16 Dec 92 22:57:10 GMT
  1755.  
  1756.  
  1757.     What is hte best way to mount an appleshare server without any
  1758. user intervention?  I need to be able to programmatically mount a
  1759. server when users aren't around.  You can assume that I can get a password
  1760. and user account if necessary.  I tried resolving aliases but it seems
  1761. to always bring up the login dialog box so that won't do.  Any ideas?
  1762. <==================================Q======================================>
  1763.   Chris Evans                      |   Internet: evans@natural.com
  1764.   Development                      |   Phone: 617-876-4876
  1765.   Natural Intelligence, Inc.       |   FAX:   617-492-7425
  1766.   2067 Massachusetts Avenue        |   AppleLink: NATURAL
  1767.   Cambridge MA  02140              |   or evans@natural.com@INTERNET#
  1768.  
  1769.                  Heavy, adj.:
  1770.          Seduced by the chocolate side of the force.
  1771.  
  1772.  
  1773. 
  1774. 
  1775. Path: ucivax!gateway
  1776. From: jpff@maths.bath.ac.uk
  1777. Subject: A Dumb question
  1778. Via: uk.ac.bath.maths; Thu, 17 Dec 1992 13:06:00 +0000
  1779. Message-ID: <9212170506.aa20524@q2.ics.uci.edu>
  1780. Newsgroups: fa.think-c
  1781. Lines: 13
  1782. Date: 17 Dec 92 13:06:28 GMT
  1783.  
  1784. I am rather new to the Mac, and I have tried toi read Inside Mac, but
  1785. it is not written in my language.  I have an application which i would
  1786. like to be able o contiue to run in the background as well as
  1787. interactively.  It can happily go away for the odd hour to compute
  1788. something, and it seems a shame to hang the machine for all that time.
  1789.  
  1790. A present the rogram enters a routine on a clock interrupt to check
  1791. for Command-. as an interrupt.  What do I have to add?  I am using teh
  1792. command pckage in Think_C, and no graphics.
  1793.  
  1794. Any suggestions, or sample code in C would be appriciated.
  1795.  
  1796. ==John ff
  1797. 
  1798. 
  1799. Path: ucivax!gateway
  1800. From: kirk_crawford@qmail2.aero.org (Kirk Crawford)
  1801. Subject: Y Modem Source wanted
  1802. Message-ID: <199212171658.AA02716@aerospace.aero.org>
  1803. Posted-Date: 17 Dec 92 09:04:05 U
  1804. Newsgroups: fa.think-c
  1805. Lines: 6
  1806. Date: 17 Dec 92 16:59:07 GMT
  1807.  
  1808. Subject:  Y Modem Source wanted
  1809. Anyone have any C source code for Y Modem?  PD would be preffered.
  1810. -Kirk
  1811.  
  1812.  
  1813.  
  1814. 
  1815. 
  1816. Path: ucivax!gateway
  1817. From: umdenbo0@ccu.umanitoba.ca ("David A. Denboer")
  1818. Subject: Problems with THINK C
  1819. Message-ID: <9212172228.AA07221@ccu.UManitoba.CA>
  1820. X-Mailer: ELM [version 2.3 PL11]
  1821. Newsgroups: fa.think-c
  1822. Lines: 17
  1823. Date: 17 Dec 92 22:28:22 GMT
  1824.  
  1825. This is the second time I have had this type of problem with THINK C > 5.03
  1826.  
  1827. When declaring variables :
  1828.     extern short            numMovies;
  1829. The compiler stops and says "Invalid Declaration"
  1830. The declaration is right after :
  1831.     #include "MyApp.h"
  1832.  
  1833. For some strange reason, this is an intermittent problem.  It worked
  1834. this morning, and by about noon, it died.
  1835.  
  1836. Any help would be appreciated.
  1837. --
  1838. David A. denBoer                    * Musi Computer Products
  1839. umdenbo0@next01.cc.umanitoba.ca   (NeXT Mail welcome)    * 9 Abington Rd
  1840. Manitoba Macintosh Developers Assn            * Winnipeg, MB
  1841. mac-develop-request@ccu.umanitoba.ca             * Canada, R2J 3S7
  1842. 
  1843. 
  1844. Path: ucivax!gateway
  1845. From: asaria@rrdtc.donnelley.com
  1846. Subject: FSSpec for the running application
  1847. Message-ID: <9212181939.AA18089@uu.psi.com>
  1848. Newsgroups: fa.think-c
  1849. Lines: 17
  1850. Date: 18 Dec 92 19:46:46 GMT
  1851.  
  1852.  
  1853. Hello,
  1854.  
  1855. I'm trying to open up a file in the same folder as my application.  What's
  1856. the best way to do this?
  1857.  
  1858. I thought that if I could get an FSSpec for my application, then I could
  1859. use the volume and directory information to construct an FSSpec for the
  1860. file I want to open.  This seemed pretty straightforward until I tried
  1861. to find out how to get the FSSpec.  I've checked the New-IM/Files, but
  1862. didn't see how to do this.
  1863.  
  1864. I'd appreciate any help on this.
  1865.  
  1866. Thanks.
  1867.  
  1868. Riyaz
  1869. 
  1870. 
  1871. Path: ucivax!gateway
  1872. From: dnebing@andy.bgsu.edu
  1873. Subject: Re: Y Modem Source wanted
  1874. Message-ID: <9212182018.AA07687@andy.bgsu.edu>
  1875. Newsgroups: fa.think-c
  1876. Lines: 25
  1877. Date: 18 Dec 92 20:19:19 GMT
  1878.  
  1879. >Subject:  Y Modem Source wanted
  1880. >Anyone have any C source code for Y Modem?  PD would be preffered.
  1881. >-Kirk
  1882.  
  1883.   It's in the distribution to the x modem protocal.  The package
  1884. includes x modem, x-y modem, batch, etc. protocols.  I wouldn't know
  1885. where to look off hand, but you could probably find it using archie...
  1886.  
  1887. Dave Nebinger
  1888.  
  1889.  
  1890. /*
  1891.             Procedure:         Signature
  1892.             Purpose:           To print the signature file for David Nebinger
  1893. */
  1894.  
  1895. void Signature(void){
  1896.             printf("%s\n%s                %s\n%s\n%s\n",
  1897.                        "Dave Nebinger",
  1898.                        "dnebing@andy.bgsu.edu",
  1899.                        "dnebing@opie.bgsu.edu",
  1900.                        "Just because something is said to lighten a subject,",
  1901.                        "doesn't mean the subject is taken lightly.");
  1902. }
  1903.  
  1904. 
  1905. 
  1906. Path: ucivax!gateway
  1907. From: evans@natural.com (Christopher Evans)
  1908. Subject: hooking in to existing apps
  1909. Message-ID: <9212190154.AA00548@natural.com>
  1910. Newsgroups: fa.think-c
  1911. Lines: 21
  1912. Date: 19 Dec 92 03:04:30 GMT
  1913.  
  1914.  
  1915.     Can anyone point me to some sample code for hooking in to existing
  1916. applications and either adding controls to window bars, adding menus to
  1917. menu bars and / or capturing keystrokes before they are passed to the
  1918. application?  I want to be able to add features to an text application
  1919. that don't currently exist.
  1920.  
  1921.     Any help will be appreciated.
  1922.  
  1923. <==================================Q======================================>
  1924.   Chris Evans                      |   Internet: evans@natural.com
  1925.   Development                      |   Phone: 617-876-4876
  1926.   Natural Intelligence, Inc.       |   FAX:   617-492-7425
  1927.   2067 Massachusetts Avenue        |   AppleLink: NATURAL
  1928.   Cambridge MA  02140              |   or evans@natural.com@INTERNET#
  1929.  
  1930.                   Dawn, n.:
  1931.         The time when men of reason go to bed.
  1932.          -- Ambrose Bierce, "The Devil's Dictionary"
  1933.  
  1934.  
  1935. 
  1936. 
  1937. Path: ucivax!gateway
  1938. From: jgarner@seattleu.edu (Jeff Garner)
  1939. Subject: Re: FSSpec for the running application
  1940. Message-ID: <Pine.3.03.9212182212.A16323-c100000@sumax.seattleu.edu>
  1941. In-Reply-To: <9212181939.AA18089@uu.psi.com>
  1942. Content-Type: TEXT/PLAIN; charset=US-ASCII
  1943. Mime-Version: 1.0
  1944. Newsgroups: fa.think-c
  1945. Lines: 79
  1946. Date: 19 Dec 92 06:39:50 GMT
  1947.  
  1948. This was already answered in an earlier post... and I was glad I had
  1949. captured it, cause I had to do the exact same thing in one of my projects
  1950. yesterday!  Here's what I had captured:
  1951.  
  1952. SCHENKL@vax.cs.hscsyr.edu wrote:
  1953.  
  1954. >I'm writing an INIT, that every hour will read a resource from it's file, but
  1955. >for the life of me I don't know how to find out how to re-open it!  I'm
  1956. looking
  1957. >for a System 6.x compatable command that will tell me the name and vRef, or
  1958. >I guess a FSSpec will do, of my INIT file at startup time.  I know there
  1959. is a
  1960. >way do to it, and I think that at one time I had some code to do it, but I
  1961. >can't seem to find it here.  (I have the develope CD Rom (vX) here, so if
  1962. it's
  1963. >on it just tell me a name...)
  1964.  
  1965. Just call the following routine with the refNum set to CurResFile(). You
  1966. could rewrite it to use other than FSSpecs.
  1967.  
  1968. pr
  1969. --
  1970. Pete Resnick        (...so what is a mojo, and why would one be rising?)
  1971. Graduate assistant - Philosophy Department, Gregory Hall, UIUC
  1972. System manager - Cognitive Science Group, Beckman Institute, UIUC
  1973. Internet: resnick@cogsci.uiuc.edu
  1974. OSErr RefNumToFSSpec(short refNum, FSSpecPtr fileSpec)
  1975. {
  1976.     OSErr errCode;
  1977.     FCBPBRec theFCB;
  1978.     long myAttributes;
  1979.  
  1980.     theFCB.ioCompletion = nil;
  1981.     theFCB.ioNamePtr = fileSpec->name;
  1982.     theFCB.ioVRefNum = 0;
  1983.     theFCB.ioRefNum = refNum;
  1984.     theFCB.ioFCBIndx = 0L;
  1985.     errCode = PBGetFCBInfoSync(&theFCB);
  1986.     fileSpec->vRefNum = theFCB.ioFCBVRefNum;
  1987.     fileSpec->parID = theFCB.ioFCBParID;
  1988.     if(TrapAvailable(_GestaltDispatch) && (Gestalt(gestaltFSAttr,
  1989. &myAttributes) == noErr) && (myAttributes & (1 << gestaltHasFSSpecCalls)))
  1990.         FSMakeFSSpec(fileSpec->vRefNum, fileSpec->parID,
  1991. fileSpec->name, fileSpec);
  1992.     return(errCode);
  1993. }
  1994.  
  1995. -=-=-=-=-=-=-=-=-=-=-==-
  1996. The answer came from Pete Resnick <resnick@cogsci.uiuc.edu>
  1997. Thanks, Pete!
  1998.  
  1999.  
  2000. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  2001. Jeff Garner     Shoestring Software Products   jgarner@seattleu.edu
  2002. (206) 232-1096   Mercer Island, Washington     jgarner@visual.spk.wa.us
  2003.  
  2004.  
  2005. On 18 Dec 1992 asaria@rrdtc.donnelley.com wrote:
  2006.  
  2007. >
  2008. > Hello,
  2009. >
  2010. > I'm trying to open up a file in the same folder as my application.  What's
  2011. > the best way to do this?
  2012. >
  2013. > I thought that if I could get an FSSpec for my application, then I could
  2014. > use the volume and directory information to construct an FSSpec for the
  2015. > file I want to open.  This seemed pretty straightforward until I tried
  2016. > to find out how to get the FSSpec.  I've checked the New-IM/Files, but
  2017. > didn't see how to do this.
  2018. >
  2019. > I'd appreciate any help on this.
  2020. >
  2021. > Thanks.
  2022. >
  2023. > Riyaz
  2024.  
  2025.  
  2026.  
  2027. 
  2028. 
  2029. Path: ucivax!gateway
  2030. From: resnick@cogsci.uiuc.edu (Pete Resnick)
  2031. Subject: Re: FSSpec for the running application
  2032. X-Sender: resnick@tarski.cogsci.uiuc.edu
  2033. Message-ID: <199212190702.AA01798@tarski.cogsci.uiuc.edu>
  2034. Newsgroups: fa.think-c
  2035. Lines: 40
  2036. Date: 19 Dec 92 07:02:52 GMT
  2037.  
  2038. At  7:46 PM 12/18/92 +0000, asaria@rrdtc.donnelley.com wrote:
  2039.  
  2040. >I thought that if I could get an FSSpec for my application, then I could
  2041. >use the volume and directory information to construct an FSSpec for the
  2042. >file I want to open.  This seemed pretty straightforward until I tried
  2043. >to find out how to get the FSSpec.  I've checked the New-IM/Files, but
  2044. >didn't see how to do this.
  2045.  
  2046. You could pass CurResFile() to the following routine:
  2047.  
  2048. OSErr RefNumToFSSpec(short refNum, FSSpecPtr fileSpec)
  2049. {
  2050.         OSErr errCode;
  2051.         FCBPBRec theFCB;
  2052.         long myAttributes;
  2053.  
  2054.         theFCB.ioCompletion = nil;
  2055.         theFCB.ioNamePtr = fileSpec->name;
  2056.         theFCB.ioVRefNum = 0;
  2057.         theFCB.ioRefNum = refNum;
  2058.         theFCB.ioFCBIndx = 0L;
  2059.         errCode = PBGetFCBInfoSync(&theFCB);
  2060.         fileSpec->vRefNum = theFCB.ioFCBVRefNum;
  2061.         fileSpec->parID = theFCB.ioFCBParID;
  2062.         if(TrapAvailable(_GestaltDispatch) &&
  2063.            (Gestalt(gestaltFSAttr, &myAttributes) == noErr) &&
  2064.            (myAttributes & (1 << gestaltHasFSSpecCalls)))
  2065.                 FSMakeFSSpec(fileSpec->vRefNum,
  2066.                              fileSpec->parID, fileSpec->name,
  2067.                              fileSpec);
  2068.         return(errCode);
  2069. }
  2070.  
  2071. pr
  2072. --
  2073. Pete Resnick        (...so what is a mojo, and why would one be rising?)
  2074. Graduate assistant - Philosophy Department, Gregory Hall, UIUC
  2075. System manager - Cognitive Science Group, Beckman Institute, UIUC
  2076. Internet: resnick@cogsci.uiuc.edu
  2077.  
  2078. 
  2079. 
  2080. Path: ucivax!gateway
  2081. From: D1620@applelink.apple.com ("Working SW, M Crawford,PAS")
  2082. Subject: About Word Services
  2083. Message-ID: <724759704.0245808@AppleLink.Apple.COM>
  2084. Newsgroups: fa.think-c
  2085. Lines: 84
  2086. Date: 19 Dec 92 10:23:25 GMT
  2087.  
  2088. I'd like to say a few words about the Word Services SDK that Mark Nagel kindly
  2089. posted on ics.uci.edu.  (The file is /mac/think-c/demos/ws-sdk-1.0.hqx - it is
  2090. 504K).
  2091.  
  2092. Word Services is an Apple Event protocol that allows any application to have
  2093. its text processed by an external speller, grammar checker, hyphenator, or
  2094. other text service as if it were a built in menu item.  Working Software
  2095. developed the protocol in cooperation with our competitors in the spelling
  2096. business, as well as several grammar checker and word processor publishers and
  2097. Apple Computer.
  2098.  
  2099. This is a public protocol.  No license fee or non-disclosure is required to use
  2100. it.  The SDK is free, and you may use the source code on it for free.
  2101.  
  2102. With Word Services, every service that a user purchases will be available in
  2103. every application.  You can provide for services such as spellchecking
  2104. without...
  2105.  
  2106. o paying any license fees
  2107. o debugging somebody else's wierd OEM speller code
  2108. o stripping features to save space
  2109. o taking up expensive space for dictionaries on your distribution disks.
  2110. o having to worry about foreign languages
  2111.  
  2112. The user has the added benefit of saving disk space by only having a single
  2113. dictionary for use by all programs, as well as a single user interface for each
  2114. service.  Of coure more exotic services than spellers will be available before
  2115. long.
  2116.  
  2117. The SDK contains Writeswell Jr., a simple text editor that supports word
  2118. services, with complete source code, as well as a debugging version of our
  2119. spellchecker, a dictionary, and the protocol specification.
  2120.  
  2121. We have just released Spellswell 7, an update to our Spellswell spelling
  2122. checker that now supports Word Services.  Spellers are under development in
  2123. German, French, and Turkish.  It is supported on the client side by Fair
  2124. Witness from Chena Software.  A number of other clients are under development
  2125. as well.
  2126.  
  2127. (The AppleScript Beta CD that Apple is sending to Apple Associates and Partners
  2128. lists some of the clients in the AppleScript Interactive Datasheet that is in
  2129. the Open Me First folder.  The Word Services SDK is on the CD as well.  Or you
  2130. can send six bucks for postage and handling to Working Software.  Or come by
  2131. the office in Santa Cruz, I'll just give you the disk for free).
  2132.  
  2133. The sample code is also useful for any other Apple Event or AppleScript code.
  2134. Novice programmers will find the code useful as an example of how to support
  2135. common Macintosh application components such as:
  2136.  
  2137. o Windows
  2138. - resizing
  2139. - zooming
  2140. - moving
  2141. - scrolling
  2142. o Menus
  2143. - dynamic menus
  2144. - font menus
  2145. - style menus, including custom font sizes
  2146. - menu icons
  2147. o Preferences files
  2148. o Styled TextEdit
  2149. o Scroll bars
  2150. o Saving and reading files
  2151. - both data and resource forks
  2152. o Handling the Clipboard
  2153. o Printing
  2154. o Modal Dialogs
  2155. - scrolling lists in dialogs
  2156. - radio buttons
  2157. - check boxes
  2158. - editable text
  2159. - default button outlines
  2160. o Desk Accessory support
  2161.  
  2162. Sincerely,
  2163.  
  2164. Michael D. Crawford
  2165. Product Development Manager
  2166. Working Software, Inc.
  2167. 740 Front Street #318
  2168. PO Box 1844
  2169. Santa Cruz, CA 95061-1844
  2170. d1620@applelink.apple.com
  2171.  
  2172. 
  2173. 
  2174. Path: ucivax!gateway
  2175. From: igorl@uiuc.edu (Igor Livshits)
  2176. Subject: Re: FSSpec for the running application
  2177. X-Sender: igorl@ncsa.uiuc.edu
  2178. Message-ID: <9212192113.AA06458@mars.ncsa.uiuc.edu>
  2179. Newsgroups: fa.think-c
  2180. Lines: 14
  2181. Date: 19 Dec 92 21:13:49 GMT
  2182.  
  2183. Pete's example:
  2184.  
  2185. >You could pass CurResFile() to the following routine:
  2186. >
  2187. >OSErr RefNumToFSSpec(short refNum, FSSpecPtr fileSpec)
  2188.  
  2189.  
  2190. Would this also be the best way to get the directory info for the current
  2191. application from within that application, or is there a better, faster way?
  2192.  
  2193. Thanks, igor
  2194. _____
  2195. NCSA-UIUC,  e:igorl@uiuc.edu,  p:(217) 244-5606
  2196.  
  2197. 
  2198. 
  2199. Path: ucivax!gateway
  2200. From: dnebing@andy.bgsu.edu
  2201. Subject: Programming group and the 32k barrier
  2202. Message-ID: <9212192330.AA18815@andy.bgsu.edu>
  2203. Newsgroups: fa.think-c
  2204. Lines: 53
  2205. Date: 19 Dec 92 23:30:49 GMT
  2206.  
  2207.  
  2208.   TextEdit is limited to files smaller than 32k.  Doesn't that suck!
  2209.  
  2210.   Well, instead of complaining about the limits on TextEdit, I would like
  2211. to do something about it.  I think there is a need for something that is
  2212. public-domain that can handle this problem, whether in the form of a
  2213. library or actual source code.
  2214.  
  2215.   Now before you think about whipping out those flame-throwers and
  2216. thrashing me for not looking into other options, I want to tell you that
  2217. I have.  These are my thoughts:
  2218.  
  2219.   1)  Existing PD or ShareWare editors:  There is quite a range of these
  2220.       that are available to anyone who can ftp them.  And these are all
  2221.       very good programs.  While they are fine as editor in themselves,
  2222.       there still is no way to handle the files greater than 32k by
  2223.       your own application.  You must either communicate directly with
  2224.       the editor or trust the user to do all of the work.  While this
  2225.       can solve the problem, it becomes quite a hassle for the user to
  2226.       be switching in and out of two apps.  Also, if you implement the
  2227.       communication with the application, you rely on the fact that
  2228.       the author will not change the communication method.  If it does
  2229.       change, you have to change your app to keep up compatibility.
  2230.  
  2231.   2)  I know that there is a TCL class CPEditText which can handle files
  2232.       greater than 32k.  To use this, you are restricted to to using the
  2233.       TCL.
  2234.  
  2235.   3)  I also know about the Word Solution Engine, a third party library
  2236.       for handling files greater than 32k.  This would be perfect, except
  2237.       for the price.
  2238.  
  2239.   4)  There also exists the CAPPS library from Think that came out a
  2240.       long time ago, but it is currently unsupported and I don't know
  2241.       how to get my hands on it.
  2242.  
  2243.   For these reasons,  I would like to create something to fix these
  2244. problems.  But since it is a large, somewhat complicated project, it
  2245. would probably be completed faster and easier as a group project.
  2246.  
  2247.   If you are interested in being part of such a group, email me for
  2248. more details.  The request for more information will not bind you in any
  2249. way to the group once it gets going.
  2250.  
  2251.   For more info (or the inevitable flame;), email to:
  2252.  
  2253.     dnebing@andy.bgsu.edu
  2254.  
  2255.   Thanks,
  2256.  
  2257.   Dave Nebinger
  2258.   dnebing@andy.bgsu.edu
  2259.  
  2260. 
  2261. 
  2262. Path: ucivax!gateway
  2263. From: C2MXBAR@fre.towson.edu (Aaron Barnett)
  2264. Subject: cursor patch
  2265. Message-ID: <01GSK87440KI9S66A4@TOE.TOWSON.EDU>
  2266. Content-transfer-encoding: 7BIT
  2267. MIME-version: 1.0
  2268. Newsgroups: fa.think-c
  2269. X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
  2270. Lines: 6
  2271. Date: 21 Dec 92 07:35:33 GMT
  2272. X-Envelope-to: think-c@ics.uci.edu
  2273.  
  2274. I want to change the std cursor(s) at start up.  what's the best way?
  2275.  
  2276. I was thinking of patching setcursor(), but not all app maintain a cursor.
  2277.  
  2278. thanks
  2279. aaron
  2280. 
  2281. 
  2282. Path: ucivax!gateway
  2283. From: joshua@natural.com ("Joshua D. Wachs")
  2284. Subject: Re: Reminder
  2285. X-Sender: joshua@natural
  2286. Message-ID: <9212211531.AA04348@natural.com>
  2287. Newsgroups: fa.think-c
  2288. Lines: 50
  2289. Date: 21 Dec 92 16:56:40 GMT
  2290.  
  2291. Jim... regarding your message...
  2292.  
  2293. >Thanks for your message! "Natural Intelligence!" I could do with some of
  2294. >that!
  2295.  
  2296. If you'd like a T-Shirt, send $10 + s&h... :-) (Chris says you can just
  2297. bring us down there for a week and we'll deliver 1/2 dozen and NI mugs
  2298. t-shirts for free.
  2299.  
  2300.  
  2301. >My imediate problem is that I can't even get my version of the Reminder
  2302. >to compile!
  2303. >
  2304. >. . .
  2305. >
  2306. >GetDItem (dialog, iLaunchCheckBox, &itemType, &itemHandle, &itemRect);
  2307. >if (reminder->launch = GetCtlValue ((ControlHandle) itemHandle))
  2308. >                reminder->notify.nmResp = &LaunchResponse;/*  Pointer
  2309. >types don't match! */
  2310. >else
  2311. >                reminder->notify.nmResp = &NormalResponse;/*  Pointer
  2312. >types don't match! */
  2313.  
  2314. This one was quite the bitch... pardon my french.  There are two ways
  2315. around this problem... the less "sexy" one is to change the options in the
  2316. edit menu.  Go to "Language Settings" and uncheck "Check pointer types" in
  2317. the ANSI conformance box.  I did this and it worked fine but it still
  2318. bothered me that it wouldn't be compilable.  So we finally figured out that
  2319. the problem was the the nmResp field need a pointer type of NMProcPtr.  If
  2320. you look in the "Notification.h" file, you'll see this is the case.  You
  2321. need to change the two lines to the following...
  2322.  
  2323. if ( reminder->launch = GetCtlValue( (ControlHandle)itemHandle ) )
  2324.         reminder->notify.nmResp = (NMProcPtr)&LaunchResponse;
  2325. else
  2326.         reminder->notify.nmResp = (NMProcPtr)&NormalResponse;
  2327.  
  2328. This casts the pointer to type NMProcPtr... this should now compile
  2329. perfectly.  If not, please let me know...  Hope this helps other frustrated
  2330. "Primers."
  2331.  
  2332. -- Joshua
  2333. -----------------------------------------------------------------------------
  2334. NN    N  II    Joshua D. Wachs             |   Internet: joshua@natural.com
  2335. N N   N  II    President                   |   Phone: 617-876-4876
  2336. N  N  N  II    Natural Intelligence, Inc.  |   FAX:   617-492-7425
  2337. N   N N  II    2067 Massachusetts Avenue   |   AppleLink: NATURAL
  2338. N    NN  II    Cambridge MA  02140         |   CompuServe: 72427,177
  2339. -----------------------------------------------------------------------------
  2340.  
  2341. 
  2342. 
  2343. Path: ucivax!gateway
  2344. From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
  2345. Subject: link errors
  2346. Message-ID: <9212220229.AA25672@hobbes.kzoo.edu>
  2347. X-Mailer: ELM [version 2.3 PL11]
  2348. Newsgroups: fa.think-c
  2349. Lines: 17
  2350. Date: 22 Dec 92 02:27:21 GMT
  2351.  
  2352. Hi there,
  2353. This should be a simple question to answer for those more experienced than
  2354. I.
  2355.  
  2356. I am using think c version 5.04, with object extensions on. When I attempt
  2357. to compile, I am getting link errors of the type
  2358. undefined: __noMethod (oopsDebug)
  2359. undefined: __noObject (oopsDebug)
  2360.  
  2361. Can anyone tell me why?
  2362.  
  2363. thanx,
  2364.  
  2365. Jason Bobier
  2366. k059509@kzoo.edu
  2367.  
  2368. The world would be a much better place if people would think.
  2369. 
  2370. 
  2371. Path: ucivax!gateway
  2372. From: D1620@applelink.apple.com ("Working SW, M Crawford,PAS")
  2373. Subject: Re: cursor patch
  2374. Message-ID: <724994371.4964992@AppleLink.Apple.COM>
  2375. Newsgroups: fa.think-c
  2376. Lines: 13
  2377. Date: 22 Dec 92 03:40:22 GMT
  2378.  
  2379. To change the cursors for all applications, edit the resources in the system
  2380. file to put in the cursors that you want.
  2381.  
  2382. I'm not sure if the cursors are kept as ROM resources.  If so, you'll need to
  2383. override them, which can be done but requires setting some flag in a different
  2384. resource in the system.
  2385.  
  2386. This won't work if the application keeps its own cursors in its resource file,
  2387. but it will work for most applications.
  2388.  
  2389. Mike Crawford
  2390. Working Software, Inc
  2391.  
  2392. 
  2393. 
  2394. Path: ucivax!gateway
  2395. From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
  2396. Subject: link errors
  2397. Message-ID: <9212220544.AA05006@hobbes.kzoo.edu>
  2398. X-Mailer: ELM [version 2.3 PL11]
  2399. Newsgroups: fa.think-c
  2400. Lines: 10
  2401. Date: 22 Dec 92 05:41:37 GMT
  2402.  
  2403. Thanx to Jim Lynch & David Sugar.
  2404.  
  2405. I figured that out about 3 minutes after I sent the letter :-).
  2406. Is there any explanation for oopDebug's lack of these two procedures, or is
  2407. it just a practical joke by Symantec?  :-)
  2408.  
  2409. Jason Bobier
  2410. k059509@kzoo.edu
  2411.  
  2412. The world would be a much better place if people would think.
  2413. 
  2414. 
  2415. Path: ucivax!gateway
  2416. From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
  2417. Subject: Re:  link errors
  2418. Message-ID: <9212221813.AA25618@hobbes.kzoo.edu>
  2419. X-Mailer: ELM [version 2.3 PL11]
  2420. Newsgroups: fa.think-c
  2421. Lines: 13
  2422. Date: 22 Dec 92 19:16:41 GMT
  2423.  
  2424. > oopsDebug actually works... but you have to have certain #defines for it to
  2425. > work; otherwise the undefineds in oopsDebug are hooks for you to hook onto.
  2426. >
  2427.  
  2428. Could someone tell me where the #defines are documented? Or if not, what
  2429. they are?
  2430.  
  2431. thanx greatly,
  2432.  
  2433. Jason Bobier
  2434. k059509@kzoo.edu
  2435.  
  2436. The world would be a much better place if people would think.
  2437. 
  2438. 
  2439. Path: ucivax!gateway
  2440. From: k044477@hobbes.kzoo.edu ("Jamie R. McCarthy")
  2441. Subject: Checking class casting
  2442. Message-ID: <9212230003.AA09044@hobbes.kzoo.edu>
  2443. X-Mailer: ELM [version 2.3 PL11]
  2444. Newsgroups: fa.think-c
  2445. Lines: 73
  2446. Date: 23 Dec 92 00:01:12 GMT
  2447.  
  2448. If you're like me, you often write code like:
  2449.  
  2450. CMyFile *theFile;
  2451. theFile = (CMyFile*) aFunctionThatReturnsACFileObject();
  2452. ASSERT(member(theFile, CMyFile));
  2453. theFile->doSomething();
  2454.  
  2455. or:
  2456.  
  2457. CFile *theFile;
  2458. theFile = aFunctionThatReturnsACFileObject();
  2459. ASSERT(member(theFile, CMyFile));
  2460. ((CMyFile*)theFile)->doSomething();
  2461.  
  2462. How about a macro that makes this a little easier, and optionally does
  2463. the assertion as well?
  2464.  
  2465. Drop this in your precompiled header (or anyplace you like):
  2466.  
  2467.    /* A spiffy way of typecasting objects. */
  2468. #if defined(__TCL_DEBUG__) && !defined(__NO_TCL_ASSERTIONS__)
  2469. extern void *__ocastStorage;
  2470. #define ocast(c,o)                                                   \
  2471.    (  __ocastStorage = (void*) (o),                                  \
  2472.       (!member((CObject*)(__ocastStorage), c) ?                      \
  2473.          (Failure(50, excMsgLookupFailed), 0) : 0),                  \
  2474.       ( (c*) (void*) ( ((char*)__ocastStorage) ) )                   \
  2475.    )
  2476. #else
  2477. #define ocast(c,o)                                                   \
  2478.    ((c*)(o))
  2479. #endif
  2480.  
  2481. ...and drop this somewhere in a source file (say, GlobalVars.c):
  2482.  
  2483. #if defined(__TCL_DEBUG__) && !defined(__NO_TCL_ASSERTIONS__)
  2484. void *__ocastStorage;
  2485. #endif
  2486.  
  2487. ...and write:
  2488.  
  2489. CFile *theFile;
  2490. theFile = ocast(CMyFile, aFunctionThatReturnsACFileObject());
  2491. theFile->doSomething();
  2492.  
  2493. or:
  2494.  
  2495. CFile *theFile;
  2496. theFile = aFunctionThatReturnsACFileObject();
  2497. ocast(CMyFile, theFile)->doSomething();
  2498.  
  2499. Note that the macro only evaluates the second expression once, so it is
  2500. safe to call with expressions that have side-effects.
  2501.  
  2502. When the object named is not of the proper type, the Failure() gets
  2503. called, and it should put up the "a method lookup failed. Could be a bad
  2504. cast or disposed object" error, which I figured was the most appropriate
  2505. one.  Only use ocast() with real objects, don't blindly make every
  2506. typecast an ocast()--if you call ocast(CObject, NULL), for example,
  2507. you'll get an error.
  2508.  
  2509. The macro adds about 60 bytes of object code per call to my app.  Your
  2510. mileage may vary.
  2511.  
  2512. By the way, __NO_TCL_ASSERTIONS__ is my own symbol that I #define when I
  2513. want full exception-handling but don't want ASSERT()s.  I had to mess
  2514. with Exceptions.c and some other stuff to get it to be that way;  if
  2515. anyone knows of an easier way, please let me know.  Thanks.
  2516. --
  2517.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  2518.  "Apple developers will still have access to System 7.1 through the
  2519.   monthly Developer CD series, but they may use it only for testing
  2520.   and development purposes."              - AppleDirect, Nov/Dec 92
  2521. 
  2522. 
  2523. Path: ucivax!gateway
  2524. From: jwachs@jpmorgan.com (Josh Wachs)
  2525. Subject: SetDialogDefaultItem
  2526. Message-ID: <9212231340.AA06976@mp670-sybase.ny.jpmorgan.com>
  2527. Newsgroups: fa.think-c
  2528. Lines: 28
  2529. Date: 23 Dec 92 13:40:46 GMT
  2530.  
  2531. Yet another C Primer (v1, 2 ed.) questions...
  2532.  
  2533. I have managed to get reminder to work but am still stumped
  2534. on the "SetDialogDefaultItem" command.
  2535.  
  2536. According to the book, when SetDialogDefaultItem is called as follows:
  2537.  
  2538. SetDialogDefaultItem( dialog, ok );
  2539.  
  2540. A border should be drawn around the OK button and enter should accept
  2541. the dialog.  It doesn't.  The same code also doesn't work in the next
  2542. chapter's ResWriter project.
  2543.  
  2544. I know filters are the way to go w/ dialogs but I would like to get this
  2545. to work "as advertised" if possible.  Has anyone had any luck w/ this?
  2546.  
  2547. Thanks...
  2548.  
  2549. -- Joshua
  2550.  
  2551. -----------------------------------------------------------------------------
  2552. NN    N  II    Joshua D. Wachs             |   Internet: joshua@natural.com
  2553. N N   N  II    President                   |   Phone: 617-876-4876
  2554. N  N  N  II    Natural Intelligence, Inc.  |   FAX:   617-492-7425
  2555. N   N N  II    2067 Massachusetts Avenue   |   AppleLink: NATURAL
  2556. N    NN  II    Cambridge MA  02140         |   CompuServe: 72427,177
  2557. -----------------------------------------------------------------------------
  2558.  
  2559. 
  2560. 
  2561. Path: ucivax!gateway
  2562. From: tempel@monmouth-etdl1.army.mil (George Tempel)
  2563. Subject: Re: SetDialogDefaultItem
  2564. Message-ID: <01GSNGYU270Y91VTDT@MONMOUTH-etdl1.Army.MIL>
  2565. Content-transfer-encoding: 7BIT
  2566. X-Mailer: LeeMail 1.2.4
  2567. Newsgroups: fa.think-c
  2568. Lines: 41
  2569. Date: 23 Dec 92 15:18:17 GMT
  2570.  
  2571. >Yet another C Primer (v1, 2 ed.) questions...
  2572. >
  2573. >I have managed to get reminder to work but am still stumped
  2574. >on the "SetDialogDefaultItem" command.
  2575. >
  2576. >According to the book, when SetDialogDefaultItem is called as follows:
  2577. >
  2578. >SetDialogDefaultItem( dialog, ok );
  2579. >
  2580. >A border should be drawn around the OK button and enter should accept
  2581. >the dialog.  It doesn't.  The same code also doesn't work in the next
  2582. >chapter's ResWriter project.
  2583. >
  2584. >I know filters are the way to go w/ dialogs but I would like to get this
  2585. >to work "as advertised" if possible.  Has anyone had any luck w/ this?
  2586. >
  2587. >Thanks...
  2588. >
  2589. >-- Joshua
  2590. >
  2591.  
  2592. nope, i've been trying to use it to for about 6 months now off and on, and
  2593. still no luck. I've even seen an in-line assembler hack that's supposed to
  2594. work and doesn't. If you find an answer let me know.
  2595.  
  2596. >-----------------------------------------------------------------------------
  2597. >NN    N  II    Joshua D. Wachs             |   Internet: joshua@natural.com
  2598. >N N   N  II    President                   |   Phone: 617-876-4876
  2599. >N  N  N  II    Natural Intelligence, Inc.  |   FAX:   617-492-7425
  2600. >N   N N  II    2067 Massachusetts Avenue   |   AppleLink: NATURAL
  2601. >N    NN  II    Cambridge MA  02140         |   CompuServe: 72427,177
  2602. >-----------------------------------------------------------------------------
  2603. >
  2604.  
  2605. "Oh no, not again..."--Douglas Adams
  2606.  
  2607. george f tempel
  2608. tempel@monmouth-etdl1.army.mil (144.252.1.1)
  2609. netromancr@aol.com (AmericaOnline)
  2610.  
  2611.  
  2612. 
  2613. 
  2614. Path: ucivax!gateway
  2615. From: jimlynch@netcom.com (Jim Lynch)
  2616. Subject: Re:  link errors
  2617. Message-ID: <9212231938.AA11917@netcom2.netcom.com>
  2618. Newsgroups: fa.think-c
  2619. Lines: 8
  2620. Date: 23 Dec 92 19:39:56 GMT
  2621.  
  2622. In your _prefix_, you should add the line
  2623.  
  2624. #define __TCL_DEBUG__ 1
  2625.  
  2626. Also, if you use a precompiled header file including MacHeaders and the headers
  2627. of TCL, you must re-precompile it (or build a separate one like I did).
  2628.  
  2629. BTW, building a precompiled header file w/ tcl headers is highly recommended.
  2630. 
  2631. 
  2632. Path: ucivax!gateway
  2633. From: jimlynch@netcom.com (Jim Lynch)
  2634. Subject: Re:  Checking class casting
  2635. Message-ID: <9212231941.AA12049@netcom2.netcom.com>
  2636. Newsgroups: fa.think-c
  2637. Lines: 2
  2638. Date: 23 Dec 92 19:42:52 GMT
  2639.  
  2640. Jamie mentions GlobalVars.c... GlobalVars.h is also useful (but missing, so I
  2641. made my own)
  2642. 
  2643. 
  2644. Path: ucivax!gateway
  2645. From: jimlynch@netcom.com (Jim Lynch)
  2646. Subject: Re: SetDialogDefaultItem
  2647. Message-ID: <9212231950.AA12477@netcom2.netcom.com>
  2648. Newsgroups: fa.think-c
  2649. Lines: 1
  2650. Date: 23 Dec 92 19:51:47 GMT
  2651.  
  2652. use tcl! it does everything you want to do and more...
  2653. 
  2654. 
  2655. Path: ucivax!gateway
  2656. From: nagel@ics.uci.edu (Mark Nagel)
  2657. Subject: ARCHIVE: AutoGuest patches
  2658. Message-ID: <5843.725146473@ics.uci.edu>
  2659. Newsgroups: fa.think-c
  2660. Reply-To: think-c-request@ics.uci.edu
  2661. Lines: 27
  2662. Date: 23 Dec 92 21:34:42 GMT
  2663.  
  2664.  
  2665. Date: Tue, 22 Dec 92 10:17:19 -0500
  2666. From: MIKOLIC-TORREI I <iom@dsunx1.dsrd.ornl.gov>
  2667. Subject: Submission:  AutoGuest patches
  2668.  
  2669.  
  2670. This file contains the AutoGuest patches.
  2671.  
  2672. The AutoGuest patches allow your code to send an AppleEvent to
  2673. a remote Mac without any user interaction IF THE REMOTE MAC
  2674. ALLOWS <GUEST> TO PROGRAM LINK.
  2675.  
  2676. These patches are the ONLY way a background-only program can
  2677. send AppleEvents to a remote Mac.
  2678.  
  2679. This file includes both an INIT to install the patches at
  2680. start-up, and an MPW .o file containing the patches in
  2681. a form suitable for installing them from your code.
  2682. Documentation and an example are included.
  2683.  
  2684. These were provided to me by Jon Pugh <jpugh@apple.com>, and
  2685. are posted to the archive with his permission.
  2686.  
  2687. Igor Mikolic-Torreira
  2688. igormt@alumni.caltech.edu
  2689.  
  2690. [saved as: /mac/think-c/system/autoguest.hqx; 11K]
  2691. 
  2692. 
  2693. Path: ucivax!gateway
  2694. From: jharland@dogbox.acme.gen.nz (Jim Harland)
  2695. Subject: Menus
  2696. Message-ID: <ueT0VB1w165w@dogbox.acme.gen.nz>
  2697. Content-Transfer-Encoding: 8bit
  2698. Comments: Usenet User
  2699. Content-Type: text/plain; charset=ISO-8859-1
  2700. Mime-Version: 1.0
  2701. Newsgroups: fa.think-c
  2702. Organization: The Dawghaus BBS, Palmerston North, New Zealand (+64 6 357 9245)
  2703. Content-Description: Untagged text converted to MIME.
  2704. Lines: 63
  2705. Date: 24 Dec 92 05:07:33 GMT
  2706.  
  2707. Hi! I'm Jim Harland. This is my first posting.
  2708. I'm affraid I'm still both C and Toolbox naive.
  2709.  
  2710. My immediate problem is that I'm affecting some modifications to the
  2711. NewClassDemo that comes with THINK C 5.0, and I can't get the menus to
  2712. behave as I believe they should.
  2713.  
  2714. I've attached the original "Font", "Size", and "Style" menus as submenus
  2715. to the bottom of the "Edit" menu. (I'm not certain that this conforms
  2716. with Apple's user interface guidelines, and would be happy to receive
  2717. comment on this!) I've created or modified resources for a total of
  2718. eleven menus (including "Apple", "File", and "Edit"). Three of the seven
  2719. menus that can be pulled down from the menubar have submenus. All of my
  2720. menus and submenus pull down just fine.
  2721.  
  2722. I've associated numbers with all of my menu items (e.g., "New Record#123"
  2723. in ResEdit) and defined these numbers in the Commands.h header file
  2724. (e.g., #define cmdNR                    200L). To make sure that my menu
  2725. items actually call the requisit commands before I set about writing the
  2726. commands themselves - i.e., to make sure that I have "hooks" to attach
  2727. those commands to) I created a single dialog box and used the switch
  2728. statement in the DoCommand routine in CDemoApp.c to associate my new
  2729. dialog box with each of my commands and hense to call it when any of my
  2730. new menu items are selected.
  2731.  
  2732. Only the three (almost) standard menus (Apple, File, and Edit) that I
  2733. "borrowed" from the NewClasDemo behave properly. Through a process
  2734. involving much too much trial and error I've discovered that each of my
  2735. new menus thinks it's one of the other (original, and now sub-) menus.
  2736. Despite the fact that a particular menu item reads say
  2737. "New Record" and has "#123" appended to its title in the appropriate
  2738. resource file, and despite the fact that cmdNR is defined as a constant
  2739. having the value of 123 and subsequently calls my new dialog box, this
  2740. item might (consistantly) call the precedure associated with the first
  2741. item in say the original File menu.
  2742.  
  2743. What have I done wrong?
  2744.  
  2745. I have only 1 MBAR resource. Its ID is "1" as per the instructions in the
  2746. manuals.
  2747.  
  2748. Do I have somehow to inform the compiler that there are 4 new menus in
  2749. the menubar? Shouldn't it figure this out?
  2750.  
  2751. Perhaps the numbers I defined are out of range, or are reserved. What's
  2752. the range?
  2753.  
  2754. Perhaps there is an object the mediates the application's response to
  2755. menu selection. Maybe the DoCommand routine in CDemoApp.c isn't the place
  2756. to trap menu item selection!
  2757.  
  2758. Hellllpppppppp!!!!!!!!!!!!!"!!!
  2759.  
  2760. And have a very merry Christmas!
  2761.  
  2762. Jim
  2763.  
  2764. jharland@dogbox.acme.gen.nz
  2765.  
  2766. --
  2767. jharland@dogbox.acme.gen.nz (Jim Harland)
  2768. The Dawghaus BBS, Palmerston North, New Zealand (+64 6 357 9245)
  2769. Caller number 5058   Posting number: 1509   MD-DOS Waffle version 1.65
  2770. 
  2771. 
  2772. Path: ucivax!gateway
  2773. From: jimlynch@netcom.com (Jim Lynch)
  2774. Subject: Re: menus
  2775. Message-ID: <9212241103.AA28973@netcom2.netcom.com>
  2776. Newsgroups: fa.think-c
  2777. Lines: 37
  2778. Date: 24 Dec 92 11:04:57 GMT
  2779.  
  2780. I was scratching my head until you mentioned reserved command numbers. You're
  2781. right, the TCL reserves the commands in the range 1 to 1023 (THINK C OOP manual
  2782. page 193).
  2783.  
  2784. While the command (eventually) gets to your subclass of CApplication, there is
  2785. a special object that is responsable for storing the command numbers of menus
  2786. and which you must inform of your hierarchical menus. This object class is the
  2787. CBartender. To learn about it, see THINK C OOP manual starting on page 191.
  2788. Discussion of hierarchical menus starts on page 196, basic info follows:
  2789.  
  2790. You can set up hierarchical menus in your resource file, but you need to be
  2791. aware of the special use for the command key and item mark fields in the menu
  2792. data structure. In the TCL, special meaning is attached to the command key
  2793. equivalent field and the item mark field of the menu item to which your
  2794. hierarchical menu will attach. The item mark field of this menu item should
  2795. contain the resource ID of your hierarchical menu and command key equivalent
  2796. field of the menu item should contain the hex value 1B, or control-[. Remember
  2797. that the menu item that should have these special values is the one you want
  2798. to pop up your hierarchical menu.
  2799.  
  2800. It is possible to have a hierarchil menu introduced to the CBartender. To make
  2801. this introduction, send the CBartender a 'InsertHierMenu()' message. The (one
  2802. and only) CBartender's address is in the global variable 'gBartender', so the
  2803. message could be sent like this:
  2804.  
  2805.  'gBartender->InsertHierMenu
  2806.   (
  2807.       MenuResourceID,
  2808.       dimCommandNumbe^R
  2809.       dimCommandNumber,
  2810.       fromWhichMenuResourceID,
  2811.       afterWhichItem
  2812.   ) ;' (without the quotes.)
  2813.  
  2814. An example is provided on page 197. Good luck.
  2815.  
  2816. -Jim
  2817. 
  2818. 
  2819. Path: ucivax!gateway
  2820. From: jharland@dogbox.acme.gen.nz (Jim Harland)
  2821. Subject: Menus
  2822. Message-ID: <e0TBwB1w165w@dogbox.acme.gen.nz>
  2823. Content-Transfer-Encoding: 8bit
  2824. Comments: Usenet User
  2825. Content-Type: text/plain; charset=ISO-8859-1
  2826. Mime-Version: 1.0
  2827. Newsgroups: fa.think-c
  2828. Organization: The Dawghaus BBS, Palmerston North, New Zealand (+64 6 357 9245)
  2829. Content-Description: Untagged text converted to MIME.
  2830. Lines: 63
  2831. Date: 25 Dec 92 08:11:03 GMT
  2832.  
  2833. Hi! I'm Jim Harland. This is my first posting.
  2834. I'm affraid I'm still both C and Toolbox naive.
  2835.  
  2836. My immediate problem is that I'm affecting some modifications to the
  2837. NewClassDemo that comes with THINK C 5.0, and I can't get the menus to
  2838. behave as I believe they should.
  2839.  
  2840. I've attached the original "Font", "Size", and "Style" menus as submenus
  2841. to the bottom of the "Edit" menu. (I'm not certain that this conforms
  2842. with Apple's user interface guidelines, and would be happy to receive
  2843. comment on this!) I've created or modified resources for a total of
  2844. eleven menus (including "Apple", "File", and "Edit"). Three of the seven
  2845. menus that can be pulled down from the menubar have submenus. All of my
  2846. menus and submenus pull down just fine.
  2847.  
  2848. I've associated numbers with all of my menu items (e.g., "New Record#123"
  2849. in ResEdit) and defined these numbers in the Commands.h header file
  2850. (e.g., #define cmdNR                    200L). To make sure that my menu
  2851. items actually call the requisit commands before I set about writing the
  2852. commands themselves - i.e., to make sure that I have "hooks" to attach
  2853. those commands to) I created a single dialog box and used the switch
  2854. statement in the DoCommand routine in CDemoApp.c to associate my new
  2855. dialog box with each of my commands and hense to call it when any of my
  2856. new menu items are selected.
  2857.  
  2858. Only the three (almost) standard menus (Apple, File, and Edit) that I
  2859. "borrowed" from the NewClasDemo behave properly. Through a process
  2860. involving much too much trial and error I've discovered that each of my
  2861. new menus thinks it's one of the other (original, and now sub-) menus.
  2862. Despite the fact that a particular menu item reads say
  2863. "New Record" and has "#123" appended to its title in the appropriate
  2864. resource file, and despite the fact that cmdNR is defined as a constant
  2865. having the value of 123 and subsequently calls my new dialog box, this
  2866. item might (consistantly) call the precedure associated with the first
  2867. item in say the original File menu.
  2868.  
  2869. What have I done wrong?
  2870.  
  2871. I have only 1 MBAR resource. Its ID is "1" as per the instructions in the
  2872. manuals.
  2873.  
  2874. Do I have somehow to inform the compiler that there are 4 new menus in
  2875. the menubar? Shouldn't it figure this out?
  2876.  
  2877. Perhaps the numbers I defined are out of range, or are reserved. What's
  2878. the range?
  2879.  
  2880. Perhaps there is an object the mediates the application's response to
  2881. menu selection. Maybe the DoCommand routine in CDemoApp.c isn't the place
  2882. to trap menu item selection!
  2883.  
  2884. Hellllpppppppp!!!!!!!!!!!!!"!!!
  2885.  
  2886. And have a very merry Christmas!
  2887.  
  2888. Jim
  2889.  
  2890. jharland@dogbox.acme.gen.nz
  2891.  
  2892. --
  2893. jharland@dogbox.acme.gen.nz (Jim Harland)
  2894. The Dawghaus BBS, Palmerston North, New Zealand (+64 6 357 9245)
  2895. Caller number 5080   Posting number: 1509   MD-DOS Waffle version 1.65
  2896. 
  2897. 
  2898. Path: ucivax!gateway
  2899. From: russne@catseq.catlin.edu (Russ Nelson)
  2900. Subject: A little problem
  2901. Message-ID: <Pine.2.27-experimental.9212270945.A22927@catseq.catlin.edu>
  2902. Content-Type: TEXT/PLAIN; charset=US-ASCII
  2903. Mime-Version: 1.0
  2904. Newsgroups: fa.think-c
  2905. Lines: 21
  2906. Date: 27 Dec 92 18:00:06 GMT
  2907.  
  2908. See if you can help me out on this.
  2909.  
  2910.   Handle    copyCount;
  2911.  
  2912.   copyCount = NewHandle(sizeof(short));
  2913.       /* Make a new handle for the number of items in the clipboard */
  2914.   HLock(copyCount);
  2915.   (**copyCount) = (char)ScrapInfo.scrapCount;
  2916.   HUnlock(copyCount);
  2917.   AddResource(copyCount, 'TCnt', 256, "\pYesterday's DJIA");
  2918.       /* Save the count to the file */
  2919.   if((resErr = ResError())) goto finish;
  2920.  
  2921.  
  2922. resErr comes out as -194, which according to System Errors DA is
  2923. addResource failed (real helpful, Apple!). I'd appreciate any insight.
  2924. Thanks in advance.
  2925.  
  2926. Russ Nelson   *  internet:  russne@catseq.catlin.edu  *   bitnet:  nelson@catlin
  2927. ->This came directly from a computer and is not to be doubted or disbelieved.<-
  2928.  
  2929. 
  2930. 
  2931. Path: ucivax!gateway
  2932. From: dmorley@clam.rutgers.edu (darin s morley)
  2933. Subject: Programming in SANE
  2934. Message-ID: <CMM-RU.1.3.725500964.dmorley@clam.rutgers.edu>
  2935. Newsgroups: fa.think-c
  2936. Lines: 5
  2937. Date: 28 Dec 92 00:02:54 GMT
  2938.  
  2939. i want to convert some math functions to SANE and try to standardize my
  2940. numerical code in it as well. is there an easy way to learn more about SANE?
  2941. is there a book on using SANE with Think C?
  2942.  
  2943. dmorley@clam.rutgers.edu
  2944. 
  2945. 
  2946. Path: ucivax!gateway
  2947. From: andreas_morgen@sfu.ca
  2948. Subject: Resource Compression
  2949. Message-ID: <9212281639.AA04579@whistler.sfu.ca>
  2950. Newsgroups: fa.think-c
  2951. Lines: 4
  2952. Date: 28 Dec 92 16:40:08 GMT
  2953.  
  2954. Is there an application availble to compress resources like Apple does with
  2955. the
  2956. operating system.
  2957.  
  2958. 
  2959. 
  2960. Path: ucivax!gateway
  2961. From: russne@catseq.catlin.edu (Russ Nelson)
  2962. Subject: Re: A Little Problem
  2963. Message-ID: <Pine.2.27-experimental.9212281147.A26984@catseq.catlin.edu>
  2964. Content-Type: TEXT/PLAIN; charset=US-ASCII
  2965. Mime-Version: 1.0
  2966. Newsgroups: fa.think-c
  2967. Lines: 11
  2968. Date: 28 Dec 92 19:58:37 GMT
  2969.  
  2970. Several people have responded to my problem, saying that I need to open a
  2971. resource file with write permissions. Unfortunately, that's not the
  2972. problem. I neglected to say that in the same code, before the segment I
  2973. posted, I opened a prefs file in the preferences folder on the current
  2974. system disk, and already wrote another resource to it, which I got no
  2975. error message for. Wierd. Thanks again.
  2976.  
  2977.  
  2978. Russ Nelson   *  internet:  russne@catseq.catlin.edu  *   bitnet:  nelson@catlin
  2979. ->This came directly from a computer and is not to be doubted or disbelieved.<-
  2980.  
  2981. 
  2982. 
  2983. Path: ucivax!gateway
  2984. From: jimlynch@netcom.com (Jim Lynch)
  2985. Subject: Re: A Little Problem
  2986. Message-ID: <9212290341.AA06948@netcom2.netcom.com>
  2987. Newsgroups: fa.think-c
  2988. Lines: 23
  2989. Date: 29 Dec 92 03:42:02 GMT
  2990.  
  2991. russne@catseq.catlin.edu (Russ Nelson) said:
  2992. >>>>>
  2993. Several people have responded to my problem, saying that I need to open a
  2994. resource file with write permissions. Unfortunately, that's not the
  2995. problem. I neglected to say that in the same code, before the segment I
  2996. posted, I opened a prefs file in the preferences folder on the current
  2997. system disk, and already wrote another resource to it, which I got no
  2998. error message for. Wierd. Thanks again.
  2999. <<<<<
  3000.  
  3001. Russ,
  3002.  
  3003. Are you still having problems? Look at _all_ of the code that gets excecuted
  3004. between the first AddResource (the successful one) and the unsuccessful one.
  3005.  
  3006. Step thru the code using your favorite debugger. You're looking for any calls
  3007. that might affect the open-ness or the current-ness (but any other ness except
  3008. Elliott :) of the file you wish to write to. Still having problems? Watch the
  3009. value of CurMap (current resource file number, _old_ inside mac v.1 pg I-116)
  3010. in the debugger while you step and watch the variable for a change. If you
  3011. find that CurMap changes, repeat the process and step into the procedure that
  3012. caused the change (or add code which makes the file current before adding the
  3013. resource).
  3014. 
  3015. 
  3016. Path: ucivax!gateway
  3017. From: P30WCC9%NIU.bitnet@uicvm.uic.edu (WES COVALT)
  3018. Subject: HyperCard XWindow
  3019. Message-ID: <9212282022.aa20855@q2.ics.uci.edu>
  3020. Newsgroups: fa.think-c
  3021. Lines: 13
  3022. Date: 29 Dec 92 04:22:08 GMT
  3023.  
  3024. Hello,
  3025.      I am having difficulty in creating a HyperCard external window.
  3026. I can get the window to appear, but I can't draw to it, nor can
  3027. I close it properly.  I do know that I am recieving events, e.g.
  3028. mouseDown and xWitinWindow, and I can move the window about the
  3029. screen.
  3030.      I would greatly appreciate an example or framework from
  3031. someone.
  3032.  
  3033. Thanks,
  3034. Wes
  3035.  
  3036. PS: The window is in the floating level, if it make a difference.
  3037. 
  3038. 
  3039. Path: ucivax!gateway
  3040. From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
  3041. Subject: modifying default text & size
  3042. Message-ID: <9212290708.AA17270@hobbes.kzoo.edu>
  3043. X-Mailer: ELM [version 2.3 PL11]
  3044. Newsgroups: fa.think-c
  3045. Lines: 24
  3046. Date: 29 Dec 92 07:05:53 GMT
  3047.  
  3048. Hi there,
  3049. I am trying to modify the default font type & size that the TC editor uses.
  3050. The default that it comes with in Monaco 9, and I would like to change it to
  3051. Monaco 10 so that I can distinguish between 0 and O, 1 and l, etc. I have a
  3052. TT version of Monaco that does this, but does not work for Monaco 9. I
  3053. believe that this means that Monaco 9 exists as a bitmapped font somewhere
  3054. in the system.
  3055.  
  3056. According to the TC manual pg 134, to change the default font, one modifies
  3057. the CNFG resource with ID 0. However, the modification rules must be
  3058. incorrect since the 1st 4 words are 0000s, with the next 4 containing data
  3059. that does not seem to correspond to anything, and the last 4 again being
  3060. 0000s.
  3061.  
  3062. Could someone please tell me how to either eliminate the bitmapped Monaco 9
  3063. (which does not appear in the system suitcase), or how to change the CNFG
  3064. resource.
  3065.  
  3066. thanx,
  3067.  
  3068. Jason Bobier
  3069. k059509@kzoo.edu
  3070.  
  3071. The world would be a much better place if people would think.
  3072. 
  3073. 
  3074. Path: ucivax!gateway
  3075. From: D1620@applelink.apple.com ("Working SW, M Crawford,PAS")
  3076. Subject: Debugging resources
  3077. Message-ID: <725614567.1112115@AppleLink.Apple.COM>
  3078. Newsgroups: fa.think-c
  3079. Lines: 38
  3080. Date: 29 Dec 92 07:45:34 GMT
  3081.  
  3082. Try using ResErrProc.  This code will break into the debugger if you have a
  3083. resource manager error:
  3084.  
  3085. pascal void MyProc(void )
  3086. {
  3087.     DebugStr("\pThere has been a resource error" );
  3088. }
  3089.  
  3090. void InstallDebugProc(void)
  3091. {
  3092.     ResErrProc = (long)MyProc;      /* Or maybe (ProcPtr)MyProc */
  3093. }
  3094.  
  3095. void RemoveDebugProc(void)
  3096. {
  3097.     ResErrProc = (long)0;
  3098. }
  3099.  
  3100. After calling InstallDebugProc, any resource manager errors will cause a break
  3101. into the debugger.  If you step out of MyProc(), you will eventually come to
  3102. the call where the error actually occurred.
  3103.  
  3104. This may not work well with a source level debugger.  Use Macsbug.
  3105.  
  3106. Also, don't ship a product with this code in it.
  3107.  
  3108. Finally, there are some resource manager calls that cause errors on purpose.  I
  3109. think some of the font manager routines do this when searching for a particular
  3110. font size that is not installed.
  3111.  
  3112. Mike Crawford
  3113. Product Development Manager
  3114. Working Software, Inc.
  3115.  
  3116. PS.  Always check the return value of ResError() after making any resource
  3117. calls.  Lots of them do not return result codes directly; you have to call
  3118. ResError() to find out.
  3119.  
  3120. 
  3121. 
  3122. Path: ucivax!gateway
  3123. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  3124. Subject: modifying default text & size
  3125. Message-ID: <9212291358.AA27353@chaos.cs.brandeis.edu>
  3126. In-Reply-To: "Jason A. Bobier"'s message of 29 Dec 92 07:05:53 GMT <9212290708.AA17270@hobbes.kzoo.edu>
  3127. Newsgroups: fa.think-c
  3128. Lines: 17
  3129. Date: 29 Dec 92 13:58:57 GMT
  3130.  
  3131. >>>>> On 29 Dec 92 07:05:53 GMT, "Jason A. Bobier" <k059509@hobbes.kzoo.edu> said:
  3132.  
  3133.  > According to the TC manual pg 134, to change the default font, one
  3134.  > modifies the CNFG resource with ID 0. However, the modification
  3135.  > rules must be incorrect since the 1st 4 words are 0000s, with the
  3136.  > next 4 containing data that does not seem to correspond to
  3137.  > anything, and the last 4 again being 0000s.
  3138.  
  3139. The manual is correct. The zeros indicate that THINK C should use its
  3140. builtin default font and tab setting, which is Monaco 9, 4 spaces per
  3141. tab. If you change the zeros, you'll get the expected results.
  3142.  
  3143.     -phil
  3144. ----
  3145.    Phil Shapiro                                   Software Engineer
  3146.    Language Products Group                     Symantec Corporation
  3147.            Internet: phils@cs.brandeis.edu
  3148. 
  3149. 
  3150. Path: ucivax!gateway
  3151. From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
  3152. Subject: Programming fonts
  3153. Message-ID: <9212291747.AA05441@hobbes.kzoo.edu>
  3154. X-Mailer: ELM [version 2.3 PL11]
  3155. Newsgroups: fa.think-c
  3156. Lines: 9
  3157. Date: 29 Dec 92 17:45:13 GMT
  3158.  
  3159. Hey, what fonts do you guys use for programming? I am interested in one that
  3160. is easily read, like Monaco 9, but with all unique letters.
  3161.  
  3162. thanx,
  3163.  
  3164. Jason Bobier
  3165. k059509@kzoo.edu
  3166.  
  3167. The world would be a much better place if people would think.
  3168. 
  3169. 
  3170. Path: ucivax!gateway
  3171. From: evans@natural.com (Christopher Evans)
  3172. Subject: Trapping TEKey
  3173. Message-ID: <9212291738.AA14033@natural.com>
  3174. Newsgroups: fa.think-c
  3175. Lines: 22
  3176. Date: 29 Dec 92 18:03:54 GMT
  3177.  
  3178.  
  3179.     I am having a problem when patching TEKey.  The problem is that
  3180. if I remap the passed in control key to another key and the position
  3181. of the cursor moves, the old cursor sometimes remains visible and the
  3182. screen begins to fill up with old vertical bar cursors.  Why is this
  3183. happenning?  It happens whether I remap the key and continue with the TEKey
  3184. trap of if I abort the trap and call TESetSelect with a new selection area
  3185. from one number to itself.  I seem to remember hearing someone talk about
  3186. this before.  Can you offer any assistance?
  3187.  
  3188.  
  3189. <==================================Q======================================>
  3190.   Chris Evans                      |   Internet: evans@natural.com
  3191.   Development                      |   Phone: 617-876-4876
  3192.   Natural Intelligence, Inc.       |   FAX:   617-492-7425
  3193.   2067 Massachusetts Avenue        |   AppleLink: NATURAL
  3194.   Cambridge MA  02140              |   or evans@natural.com@INTERNET#
  3195.  
  3196. There's no real need to do housework -- after four years it doesn't get
  3197.                   any worse.
  3198.  
  3199.  
  3200. 
  3201. 
  3202. Path: ucivax!gateway
  3203. From: D1620@applelink.apple.com ("Working SW, M Crawford,PAS")
  3204. Subject: Re: Trapping TEKey
  3205. Message-ID: <725738870.0491156@AppleLink.Apple.COM>
  3206. Newsgroups: fa.think-c
  3207. Lines: 16
  3208. Date: 30 Dec 92 18:21:04 GMT
  3209.  
  3210. Could you have tail patched TEKey?  If so, you might have broken a bug fix to
  3211. the system software.
  3212.  
  3213. See if you can make a patch in which you JMP, not JSR to the real TEKey at the
  3214. end of your patch.  I know this might not be what you really want to do - but
  3215. if TEKey starts working, it's a tail patch problem.
  3216.  
  3217. There are bug fixes in the ROMS in which some traps look up the stack to see
  3218. who called them.  If they were called from certain ROM addresses, they do
  3219. something different, resulting in fixing a bug that was in the caller's code.
  3220. Quite a hack.  There's some intelligent reason that Apple did this, but it
  3221. escapes me at the moment.
  3222.  
  3223. Mike Crawford
  3224. Working Software, Inc.
  3225.  
  3226. 
  3227. 
  3228. Path: ucivax!gateway
  3229. From: winter@ai.rl.af.mil (Jim Wintermyre)
  3230. Subject: Re: Trapping TEKey (Tail-patching)
  3231. Message-ID: <9212302150.AA04106@AI.RL.AF.MIL>
  3232. Newsgroups: fa.think-c
  3233. Lines: 33
  3234. Date: 30 Dec 92 22:00:22 GMT
  3235.  
  3236. > Could you have tail patched TEKey?  If so, you might have broken a bug fix to
  3237. > the system software.
  3238. >
  3239. > See if you can make a patch in which you JMP, not JSR to the real TEKey at the
  3240. > end of your patch.  I know this might not be what you really want to do - but
  3241. > if TEKey starts working, it's a tail patch problem.
  3242. >
  3243. > There are bug fixes in the ROMS in which some traps look up the stack to see
  3244. > who called them.  If they were called from certain ROM addresses, they do
  3245. > something different, resulting in fixing a bug that was in the caller's code.
  3246. > Quite a hack.  There's some intelligent reason that Apple did this, but it
  3247. > escapes me at the moment.
  3248.  
  3249. Just a note on tail-patching - apparently it's safe to tail-patch ANY trap if
  3250. you're using SYSTEM 7, EXCEPT for FINDWINDOW.  This came up on
  3251. comp.sys.mac.programmer a month or two ago.  I think it might've been Dean Yu
  3252. who posted it, but in any case it was someone from Apple.  System 7 has some
  3253. "magic" which allows it to determine when a trap has been tail-patched, and take
  3254. the appropriate action.
  3255.  
  3256. Also, I think that "intelligent reason" for Apple doing the bug fixes the way
  3257. you describe is that it allowed them to just write a small amount of code to fix
  3258. a ROM bug, rather than re-write the entire ROM routine (also note that these are
  3259. bug fixes TO the ROMs, not IN the ROMs).  For example, instead of rewriting the
  3260. entire MenuSelect trap because of a one-line bug, they might patch some OTHER
  3261. trap that MenuSelect calls.  They look at the return address and if it is in the
  3262. ROM (ie called by the bad MenuSelect) they do something that fixes whatever the
  3263. bug was, as you described.  This saves a lot of space in system code and RAM.
  3264.  
  3265. Jim W.
  3266.  
  3267. winter@ai.rl.af.mil
  3268. wintermyrej@lonex.rl.af.mil
  3269. 
  3270. 
  3271. Path: ucivax!gateway
  3272. From: jimlynch@netcom.com (Jim Lynch)
  3273. Subject: Re: Trapping TEKey (Tail-patching)
  3274. Message-ID: <9212310018.AA00872@netcom2.netcom.com>
  3275. Newsgroups: fa.think-c
  3276. Lines: 8
  3277. Date: 31 Dec 92 00:18:05 GMT
  3278.  
  3279. "If builders built buildings the way programmers wrote programs,
  3280. the first woodpecker that came along would have destroyed civilization."
  3281.  
  3282. If the person who came up with the idea of checkking return addresses
  3283. instead of fixing the original problem built any buildings I inspected,
  3284. I'd slap that person with a million dollar fine and tell him not to play
  3285. on the freeway if he has never done so (but if he had, I'd ask him to
  3286. remove his blindfold first).
  3287. 
  3288. 
  3289. Path: ucivax!gateway
  3290. From: D1620@applelink.apple.com ("Working SW, M Crawford,PAS")
  3291. Subject: Re: Trapping TEKey
  3292. Message-ID: <725829131.5922284@AppleLink.Apple.COM>
  3293. Newsgroups: fa.think-c
  3294. Lines: 26
  3295. Date: 31 Dec 92 19:15:34 GMT
  3296.  
  3297. Chris,
  3298.  
  3299. Even though what you intend is a head patch, if you use a JSR at the end, then
  3300. it looks like a head patch to the ROM bug-fix code (technically known as
  3301. "come-from patches").  This is because the patch code looks at return addresses
  3302. on the stack.
  3303.  
  3304. Yes, you should UNLK.  It's tricky, because you also need to have the stack
  3305. look just like it was when your code was called, because when TEKey does its
  3306. return, it will return to the function that called you.
  3307.  
  3308. I don't know whether TEKey is "come-from" patched.  Just a suspicion.
  3309.  
  3310. There may be another solution other than patching traps.  Even though you just
  3311. mean to patch the traps for your application, you also patch them for all the
  3312. desk accessories on system 6 Unifinder - it may not have the desired effect.
  3313. If you want to do something to an EditText field in a dialog, use a filterProc.
  3314. You can change the contents of the event record in a filter proc to change the
  3315. key codes.
  3316.  
  3317. Only patch traps when you really, really have to.  They're a pain to keep
  3318. working.  Believe me - most of my products are patches!
  3319.  
  3320. Mike Crawford
  3321. Working Software
  3322.  
  3323. 
  3324. 
  3325. Path: ucivax!gateway
  3326. From: winter@ai.rl.af.mil (Jim Wintermyre)
  3327. Subject: Re: Trapping TEKey
  3328. Message-ID: <9212312051.AA06017@AI.RL.AF.MIL>
  3329. Newsgroups: fa.think-c
  3330. Lines: 40
  3331. Date: 31 Dec 92 21:01:17 GMT
  3332.  
  3333. Hi!  You wrote,
  3334.  
  3335. > Chris,
  3336. >
  3337. > Even though what you intend is a head patch, if you use a JSR at the end, then
  3338. > it looks like a head patch to the ROM bug-fix code (technically known as
  3339. > "come-from patches").  This is because the patch code looks at return
  3340. addresses
  3341. > on the stack.
  3342.  
  3343. > Yes, you should UNLK.  It's tricky, because you also need to have the stack
  3344. > look just like it was when your code was called, because when TEKey does its
  3345. > return, it will return to the function that called you.
  3346.  
  3347. I guess you mean "it looks like a TAIL-patch to the ROM..."  Anyway, did you see
  3348. my posting yesterday?  You don't need to worry about it at all in system 7,
  3349. except for if you patch FindWindow.  If this has to work under system 6, then
  3350. you do have to worry about the UNLK ugliness.
  3351.  
  3352. > I don't know whether TEKey is "come-from" patched.  Just a suspicion.
  3353.  
  3354. There was a good discussion of this in Scott Knaster's "Macintosh Programming
  3355. Secrets," the 2nd edition.  Basically, a trap won't be come-from patched unless
  3356. it will be called by the ROM.  If a trap that needs to be fixed isn't called by
  3357. the ROM, it will have to be completely replaced by a fixed RAM version.  Of
  3358. course, it doesn't make any sense to patch a trap that is already in RAM - just
  3359. release system 7.1.1a2!!  Anyway, I doubt that TEKey is come-from patched, since
  3360. I can't think of any reason the ROM would be calling it.
  3361.  
  3362. > Only patch traps when you really, really have to.  They're a pain to keep
  3363. > working.  Believe me - most of my products are patches!
  3364.  
  3365. Isn't that the truth!  But hey, it's so much fun...
  3366.  
  3367. Later,
  3368.  
  3369. Jim
  3370.  
  3371. winter@ai.rl.af.mil
  3372. wintermyrej@lonex.rl.af.mil
  3373. 
  3374.